Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #24347

Re: Pass variable from Perl-AJAX-Perl

From trudge <nospam@softouch.on.ca>
Newsgroups comp.lang.javascript
Subject Re: Pass variable from Perl-AJAX-Perl
References <7akfv.180209$6A3.141820@fx29.iad> <0.cb8ce465599fb6e5a937.20140522122015BST.87lhturrf4.fsf@bsb.me.uk>
Message-ID <Xxpfv.2613762$g45.648553@fx10.iad> (permalink)
Date 2014-05-22 12:25 -0400

Show all headers | View raw


On 14-05-22 7:20 AM, Ben Bacarisse wrote:
> trudge <nospam@softouch.on.ca> writes:
> 
>> I'm stuck on a problem I'm having with a project. I have a library built
>> on a MySQL db and am trying to access it via AJAX & Perl.
>>
>> I start with an HTML page calling a Perl script to populate several
>> select lists (title, author, subject). User then picks an option (say
>> book title) which then needs to call another Perl script to provide
>> details of that choice.
>>
>> I am stuck trying to pass a variable (say the option choice) back to
>> AJAX so that I can use it to call the next Perl script.
>>
>> Is this something that is even possible with AJAX?
> 
> Yes.  You have a client-side script making an HTTP request.  That script
> has access to the DOM (the internal representation of the document your
> user is looking at) which includes selection options, checkbox states
> and so on.
> 
> The problem I have is understanding where the problem is.  What have you
> got?  What have you tried?
> 
> Maybe the problem is the form that the request will take?  The simplest
> option is to pass the data to the server in the query string of the
> requested URL.  E.g. your script might request
> "http://myserver/info?isbn=42".
> 

Hi Ben and thank you for the advice and apologies for the lack of
details. In my HTML page I call the first perl script:

ajaxRequest.open("POST", "http://127.0.0.1/cgi-bin/ajax/kba-search.pl",
true);

which populates my select lists. 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? Once I have that then
I can take your suggestion and use it in a GET or POST.

-- 
Amer

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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