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

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -