poss has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I am trying to access a javascript variable from my
perl code. All of this is in the same perl file.
ex;
At this point I would like to get the value of bar from my perl code#!/home/vobadm/perl5/bin/perl -w<BR> <BR> use CGI qw/:standard/;<BR> <BR> my $q = CGI->new();<BR> <BR> use strict;<BR> use warnings;<BR> <BR> my $foo = "abc";<BR> <br><br> print "<script type='text/javascript'><BR> function changeText(str) {<BR> alert("FOO = " + str); // this equals "abc" <br> var bar = str;<BR> bar = "xyz";<BR> return bar; <BR> }<BR> </script>";<BR> print "<table align='center' border='10' >"; <BR> print "<td width='40%'><select id='buildSelection1' onchange='changeTe +xt(\"$foo\");'>"; <BR> <p>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Access javascript variable from perl
by Corion (Patriarch) on Mar 11, 2015 at 20:37 UTC |