jQuery Rapid Async

So if you are a jQuery lover like I am, you witness many a strange happenings in manual postbacks and hacking the DOM. One of the most difficult problems I have experienced is that of a simple dropdownlist which selects a customer to consume .net web services to either update or retrieve data in a DB.

For some strange reason, in selecting from the drop-down list; I would get different results and sometimes even duplicates. Needless to say after much hunting, I came across this wonderful piece of code which prevent’s rapid async’s.

e.preventDefault();
if ($.data(this, ‘running’)) {
return;
}

$.data(this, ‘running’, true);
// do the asynchronous call

Simple, sweet and it works!

Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Leave a Reply