<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>RE: SPUG: Ajax question - js args</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Not exactly answering your question the way you want, but I think what you need to do is:<BR>
<BR>
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;<A HREF="http://builder.akc.org/ghawk.js">http://builder.akc.org/ghawk.js</A>&quot;&gt;&lt;/script&gt;<BR>
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;lookup_sellers( 'B000ERVJKO' );&lt;/script&gt;<BR>
<BR>
...<BR>
<BR>
function lookup_sellers( somearg ) {<BR>
<BR>
&nbsp; var http_request;<BR>
<BR>
&nbsp; if (window.XMLHttpRequest) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http_request = new XMLHttpRequest(); }<BR>
&nbsp; else if (window.ActiveXObject) {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http_request = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;); }<BR>
<BR>
&nbsp; if (http_request) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var obj;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj = document.getElementById('display');<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http_request.onreadystatechange = function() {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (http_request.readyState == 1) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById('display').innerHTML = '&lt;img src=<A HREF="http://www.eskimo.com/~ghawk/ajax/loading6.gif">http://www.eskimo.com/~ghawk/ajax/loading6.gif</A>&gt;';<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (http_request.readyState == 4) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById('display').innerHTML = http_request.responseText + ' ( ' + somearg + ' )';<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http_request.open(&quot;GET&quot;, &quot;<A HREF="http://builder.akc.org/cgi-bin/test/ghawk.cgi">http://builder.akc.org/cgi-bin/test/ghawk.cgi</A>&quot;, true);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http_request.send(null);<BR>
&nbsp; }<BR>
<BR>
}<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: spug-list-bounces+aeh=akc.org@pm.org on behalf of Gary Hawkins<BR>
Sent: Tue 6/20/2006 3:58 AM<BR>
To: spug-list@pm.org<BR>
Subject: SPUG: Ajax question - js args<BR>
<BR>
Hiya,<BR>
<BR>
<BR>
<BR>
I'm working with Ajax and have a real basic question.&nbsp; Meanwhile I'm going to<BR>
show what I'm doing in this Ajax example, because surely there will be<BR>
/(people)+/ that will find it intriguing or useful.<BR>
<BR>
<BR>
<BR>
My question is simply:&nbsp; How do I assign input arguments that are passed to a<BR>
.js file to variables in the js code?&nbsp; That's new to me, I think I've read ~ 42<BR>
million web pages looking for that simple building block, and no joy.<BR>
<BR>
<BR>
<BR>
Here's the example:&nbsp; <A HREF="http://www.eskimo.com/~ghawk/ajax/test.htm">http://www.eskimo.com/~ghawk/ajax/test.htm</A><BR>
<BR>
<BR>
<BR>
Once on the page, you'll see a little &quot;rotating&quot; animated gif while the<BR>
external page/information is being read.&nbsp; The Perl script triggered by the js<BR>
code is looking for the number of sellers on this page:<BR>
<A HREF="http://www.amazon.com/exec/obidos/ASIN/B000ERVJM2/">http://www.amazon.com/exec/obidos/ASIN/B000ERVJM2/</A><BR>
&lt;http://www.amazon.com/gp/product/B000ERVJM2/ref=pd_ts_d_31/102-0990943-3824922<BR>
?s=dvd&amp;v=glance&amp;n=130&gt;&nbsp; .where it says something like<BR>
&lt;http://www.amazon.com/gp/offer-listing/B000ERVJM2/ref=dp_olp_2/102-0990943-382<BR>
4922?%5Fencoding=UTF8&gt; 56 used &amp; new (the number changes of course).<BR>
<BR>
<BR>
<BR>
Once Perl has retrieved that page and extracted the number, it is returned to<BR>
the javascript (the js file that was pulled in by the htm page), and Ajax sees<BR>
the package has arrived, updates the div (id is 'display') and places the<BR>
digits there, replacing the image.<BR>
<BR>
<BR>
<BR>
So, you might notice that in the javascript, I am sending an arg:<BR>
<BR>
<BR>
<BR>
&lt;script language=&quot;javascript&quot;<BR>
src=&quot;<A HREF="http://www.eskimo.com/~ghawk/ajax/test.js?a=B000ERVJKO">http://www.eskimo.com/~ghawk/ajax/test.js?a=B000ERVJKO</A>&quot;&gt;&lt;/script&gt;<BR>
<BR>
<BR>
<BR>
...and that ASIN (Amazon Standard Identification Number) is different than the<BR>
one hardcoded (or medium coded) into the .cgi file.&nbsp; Now all I have to do is<BR>
persuade js to take in that arg so it can be handed over to the Perl script.<BR>
<BR>
<BR>
<BR>
In short, I need the js<BR>
&lt;http://www.google.com/search?as_q=&amp;num=100&amp;hl=en&amp;btnG=Google+Search&amp;as_epq=js+<BR>
equivalent+of+@ARGV&gt;&nbsp; equivalent of @ARGV.<BR>
<BR>
<BR>
<BR>
Thanks,<BR>
<BR>
<BR>
<BR>
Gary<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>