Javascript 101 - Calling a CGI script

S

stahl.karl

Howdy,

I have a CGI/Perl script that simply creates a few Javascript
variables. For example:

--------myCGI.pl----------------------------------------
print("Content-type: text/javascript\n\n"));
print("var x = 5");


Now in my .html code I have TWO <script> blocks where I call the code
as follows:

<script type="text/javascript" src="cgi-bin/myCGI.pl"></script>
<script type="text/javascript">

All other Javascript functions, some which refer to the
variables produced by CGI.

</script>


This works just fine, but it seems like there must be a way to just
simply call the CGI script from WITHIN the second block above. Maybe
something like: run("cgi-bin/myCGI.pl"). Does something like this
exist?

Thanks a million.
 
V

VK

Howdy,

I have a CGI/Perl script that simply creates a few Javascript
variables. For example:

--------myCGI.pl----------------------------------------
print("Content-type: text/javascript\n\n"));
print("var x = 5");


Now in my .html code I have TWO <script> blocks where I call the code
as follows:

<script type="text/javascript" src="cgi-bin/myCGI.pl"></script>
<script type="text/javascript">

All other Javascript functions, some which refer to the
variables produced by CGI.

</script>


This works just fine, but it seems like there must be a way to just
simply call the CGI script from WITHIN the second block above. Maybe
something like: run("cgi-bin/myCGI.pl"). Does something like this
exist?

Surprisingly enough not yet (as a common language standard)

But ajaxoids (IXMLHTTPRequest/XMLHttpRequest solutions) do the trick
pretty close to what you are looking for. Search "Ajax". See also
<http://www.ajaxtoolbox.com>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top