Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24349
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Pass variable from Perl-AJAX-Perl |
| Date | 2014-05-22 19:16 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <280169017.qlGG4jz0K9@PointedEars.de> (permalink) |
| References | <7akfv.180209$6A3.141820@fx29.iad> <0.cb8ce465599fb6e5a937.20140522122015BST.87lhturrf4.fsf@bsb.me.uk> <Xxpfv.2613762$g45.648553@fx10.iad> |
trudge wrote:
^^^^^^
Your real name should be there.
> In my HTML page I call the first perl script:
No, you do not.
> ajaxRequest.open("POST", "http://127.0.0.1/cgi-bin/ajax/kba-search.pl",
> true);
>
> which populates my select lists.
No, most certainly it does not. If you use the XMLHttpRequest API directly,
this only *prepares* to make an HTTP request to your locally installed Web
server – it is the send() call that makes it –, and the part of your code
that processes the resulting response populates the “select” elements
(likewise, in the function whose reference is assigned to the
“onreadystatechange” or “onload” property).
In a sufficiently modern runtime environment, it would go like this:
var ajaxRequest = new XMLHttpRequest();
ajaxRequest.open("POST", "http://127.0.0.1/cgi-bin/ajax/kba-search.pl",
true);
ajaxRequest.onload = function () {
/* populate the “select” elements */
};
ajaxRequest.send(null);
(A retrieval operation should be a *GET* operation instead. See REST.)
> Then I need to capture the user choice (say a book title) so I can pass it
> to another Perl script to return the data about that choice.
>
> How do I capture that data? In Perl or JavaScript?
Since Perl usally does not run in the Web browser, you would have to use an
ECMAScript implementation like JavaScript to access the DOM implementation
in order to determine the user selection.
Have you read the FAQ yet? If no, why not? Obviously you also have not
read the XHR tutorial I have referred you to.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Pass variable from Perl-AJAX-Perl trudge <nospam@softouch.on.ca> - 2014-05-22 06:18 -0400
Re: Pass variable from Perl-AJAX-Perl Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-05-22 12:20 +0100
Re: Pass variable from Perl-AJAX-Perl trudge <nospam@softouch.on.ca> - 2014-05-22 12:25 -0400
Re: Pass variable from Perl-AJAX-Perl Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-22 19:16 +0200
Re: Pass variable from Perl-AJAX-Perl John Harris <niam@jghnorth.org.uk.invalid> - 2014-05-23 10:13 +0100
Re: Pass variable from Perl-AJAX-Perl Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-22 17:30 +0000
Re: Pass variable from Perl-AJAX-Perl Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-05-22 13:27 +0200
Re: Pass variable from Perl-AJAX-Perl Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-22 17:04 +0000
Re: Pass variable from Perl-AJAX-Perl trudge <nospam@softouch.on.ca> - 2014-05-22 13:41 -0400
csiph-web