Reputation: 193
I am trying to call a perl script from my HTML page. The way am trying to do is to call the url of the perl script located on the server.
Here is the piece of code:
HTML:
var fname = "Bob";
var url='http://xxx.com:30000/cgi-bin/abc.pl?title=fname';
window.open(url,"_self");
The way am trying to retrieve it in perl as:
Perl:
print "$ARGV[0]\n";
Now, I have 3 questions:
_self
. Still it doesn't.Could anybody point out the problems?
Thanks, Buzz
Upvotes: 0
Views: 7617
Reputation: 61
There are two different environments that each pass variables two different ways. The command line can pass variables through the @ARGV and the browser can pass variables through @ENV. It doesn't matter what language you use, those are the arrays that you will have to employ.
Upvotes: 1
Reputation: 6566
In addition to what Matteo said, a simple print
statement is not enough to send some output to the browser.
Please see a recent answer I wrote giving a sample CGI script with output.
In regard to your other issues:
Variables are appended to a url separated with &
:
var url='http://xxx.com:30000/cgi-bin/abc.pl?title=fname&description=blah';
Based on this question, perhaps you should try window.location.href = url;
instead (though that doesn't explain why your code isn't working).
Upvotes: 3