Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery bind and getJSON combo not behaving as expected
    text
    copied!<p>I am loading a jQuery UI dialog and at the end of the HTML that I get with an AJAX call is the script below. I expect it to bind to a button that I have defined and to run when clicked, however it does not run. If I change the contents of the function to nothing but an alert it runs fine. JSLint has not helped me to find my problem. Can anyone tell me what I am missing?</p> <pre><code>&lt;script type="text/javascript"&gt; $("#runbutton").bind("click",function() { $("#loading").show(); $.getJSON("web.air.sum.rpt.php","json=true&amp;whse="+$("#whse").val()+"&amp;date1="+$("#date1").val()+"&amp;date2="+$("#date2").val()+"&amp;status="+$("#status").val()+"&amp;caby="+$("#caby").val()+"&amp;catarg="+$("#catarg").val(),function(data, textStatus) { $("#results").html("&lt;table width='100%' id='restbl'&gt;&lt;/table&gt;"); $("#loading").hide(); $.each(data,function(key,val) { $("#restbl") .append("&lt;tr&gt;&lt;th&gt;AIR "+val.KEY+"&lt;/th&gt;&lt;td&gt;"+val.ACCDATE+" "+val.ACCTIME+"&lt;/td&gt;&lt;/tr&gt;") .append("&lt;tr&gt;&lt;th&gt;Team Member&lt;/th&gt;&lt;td&gt;"+val.NAME+"&lt;/td&gt;&lt;/tr&gt;"); .append("&lt;tr&gt;&lt;th&gt;Target&lt;/th&gt;&lt;td&gt;"+val.TARDATE+"&lt;/td&gt;&lt;/tr&gt;"); .append("&lt;tr&gt;&lt;th&gt;Accident Description&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2'&gt;"+val.ACCDESC+"&lt;/td&gt;&lt;/tr&gt;"); .append("&lt;tr&gt;&lt;th&gt;Corrective Action&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2'&gt;"+val.CORRACT+"&lt;/td&gt;&lt;/tr&gt;"); .append("&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;By "+val.VERBY+"&lt;/td&gt;&lt;/tr&gt;"); .append("&lt;tr&gt;&lt;td colspan='2'&gt;&lt;hr&gt;&lt;/td&gt;&lt;/tr&gt;"); }); }); }); &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload