JQUERY Function within a function does not work -
i want run perl script url parameters. can not understand why second function "callscript" not work,
not working:
jquery('#hideshow').live('click', function(event) { jquery('#content').toggle('show'); var m = 'kkk'; var l = 'http://192.116.153.90/cgi-bin/rrd/y.pl?user=' + m; alert(l); function callscript(){ \$.get(l, function(data){ \$("#response").html("the perl script says: " + data); }) }
working:
<div id="response"></div> <script> var m = 'bibi'; var l = 'http://192.116.153.90/cgi-bin/rrd/y.pl?user=' + g; alert(l); function callscript(){ \$.get(l, function(data){ \$("#response").html("the perl script says: " + data); }) } </script>
you have <script> tag in middle of javascript. should using .on instead of .live (https://api.jquery.com/live/)
Comments
Post a Comment