Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery Event won't fire after ajax call
    text
    copied!<p>This is a rather strange issue with jquery. I am loading a div </p> <pre><code>&lt;div id="container"&gt; </code></pre> <p>on page load. Each record is tabular data with a 'delete' ajax function associated with it. When the page loads and clicking the 'delete' link, the ajax call fires off just fine. However, once the event is fired, the data is returned from the ajax call, and the div is populated with data (but the page does not refresh or reload) When I click the link again, the ajax script will not fire. Here is my code:</p> <pre><code>$(document).ready(function() { $("button.done").button({ }).click(function() { var BatchID = $("input#BatchID").val(); var Amount = $("input#Amount").val(); var Name = $("input#CheckName").val(); var Check_Number = $("input#Check_Number").val(); var Company = $("select#Company").val(); var Department = $("select#Department").val(); $.ajax({ type: 'GET', url: '/app/usagCheckEntryWS.html', data: { "BatchID" : BatchID, "Amount" : Amount, "Name" : Name, "Check_Number" : Check_Number, "Company" : Company, "Department" : Department }, success: function (data) { var ang = ''; var obj = $.parseJSON(data); $.each(obj, function() { ang += '&lt;table&gt;&lt;tr&gt;&lt;td width="45"&gt;' + this["RefID"] + '&lt;/td&gt;&lt;td width="140"&gt;' + this["Name"] + '&lt;/td&gt;&lt;td width="95"&gt;' + this["CheckNumber"] + '&lt;/td&gt;&lt;td align="right" width="70"&gt;$' + this["Amount"] + '&lt;/td&gt;&lt;td width="220" style="padding-left: 15px;"&gt;' + this["Description"] + '&lt;/td&gt;&lt;td&gt;&lt;div class="delete" rel="' + this["RefID"] + '"&gt;&lt;span&gt;Delete&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'; }); $('#container').html(ang); $("input#Amount").val(''); $("input#CheckName").val(''); $("input#Check_Number").val(''); $("select#Company").val('MMS'); $("th#dept").hide(); $('input#CheckName').focus(); } }); }); }); </code></pre> <p></p>
 

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