in reply to How to store the value of a Javascript function as a Perl variable
Without attempting to dumpster-dive into your particular code, you are correct in deducing that your JavaScript function must send an Ajax request to the host, containing the value(s) in question. I suggest that you spend some time generally surfing the web at this point to get a better understanding of just how AJAX (and the HTTP protocol in-general) actually works.
A really interesting way to do this is to turn-on the debugging features of your favorite browser, then go to a particular web-site that you know uses AJAX, and actually watch the two parties talking to one another. When you click a button, the JavaScript actually forms a complete request-packet and sends it asynchronously to a particular web-address that is dedicated to this purpose, receiving a similarly-formatted response in return. Basically, it is calling a subroutine on the host side and receiving the response generated by it. (This is the only way that the two sides can share data.) Then, do the same thing with your own attempt: look at what (and, whether ...) your JavaScript code is sending, and what the host does in return. You have to use a debugger for this because the AJAX interactions won’t show-up on the browser screen.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to store the value of a Javascript function as a Perl variable
by kennethk (Abbot) on Jun 23, 2014 at 17:12 UTC | |
|
Re^2: How to store the value of a Javascript function as a Perl variable
by tobyink (Canon) on Jun 23, 2014 at 23:37 UTC |