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


Groups > comp.lang.javascript > #24341

Re: Pass variable from Perl-AJAX-Perl

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Pass variable from Perl-AJAX-Perl
Date 2014-05-22 13:27 +0200
Organization PointedEars Software (PES)
Message-ID <2233284.cOHuCZCsUg@PointedEars.de> (permalink)
References <7akfv.180209$6A3.141820@fx29.iad>

Show all headers | View raw


trudge wrote:
^^^^^^
This is Usenet.  Please fix.

> I start with an HTML page

In most cases, there are no HTML pages.  The concept of “pages” depends on a 
particular form of presentation; HTML does not (a fact often carelessly 
neglected by Web authors).

> calling a Perl script to populate several select lists (title, author,
> subject).

You have server-side Perl generate an HTML document upon HTTP request, and 
the Web server to serve that document in an HTTP response to the client.

> 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.

Only in a very broad sense of “call”.  You can make an HTTP request from the 
client that causes the Web server to execute Perl, Perl to generate content, 
the Web server to serve that content in an HTTP response, and you can 
process that response on the client.

> Is this something that is even possible with AJAX? Needless to say AJAX
> is new to me.

AJAX (Asynchronous JavaScript And XML) is not a technology; it is a common 
misnomer for a *technique* (XMLHttpRequest – XHR) to make HTTP requests and 
handle the resulting HTTP responses when the main Web document has been 
loaded.  Saying to “pass something back to AJAX” or “call AJAX” makes as 
little sense as “pass something back to backtracking” or “call the 
refactoring”, for example.  (You need to call an object’s methods to make 
those HTTP requests, but that is something else.)

Knowing this now, you can answer your question.
 
> I have an existing library running strictly on Perl
> [http://www.softouch.on.ca/kb/kb.html] and thought I would try it using
> AJAX.

HTTP does not care how you generate transmitted content and mostly also not 
what the content is; neither does XHR.  This is one reason why "AJAX" is a 
misnomer, as XML is almost always not involved anymore (JSON is the 
preferred format).  The proper term, XMLHttpRequest, is the name of the 
implemented interface (originally only Microsoft’s IXMLHttpRequest), and is 
only accepted because it gives that reference, and for lack of a better 
term.

See below and STFW (avoid w3schools.com, probably even jquery.com at this 
point – and of course all football-related sites).

-- 
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 | 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