jquery ajax duplicate calls

I recently came across an issue where the ajax calls were getting duplicated upon loading the response back to the view and firing onchange event on form fields.

To fix this I just used a flag as shown below. Hope this helps

var requestSent = false;

jQuery(“#buttonID”).click(function() {
if(!requestSent) { // Only send the AJAX request if there’s no current request
requestSent = true;

url: “http://getallfix.com”,
timeout: timeoutValue,
complete: function() {

requestSent = false;// Clear variable after response


I Am suresh(suresh kumar )a Web developer,Freelancer,webdesigner,UI developer from bangalore. Got 6+ yrs of IT experience . I specialize in standards-based XHTML, CSS and JavaScript web development. Each site I develop is built to be search engine friendly (SEO), using the latest development principles and techniques.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *