I have an app that sends multiple Ajax requests simultaneously. I was originally running into race conditions until I discovered the jQuery Ajax Queue plugin, which works great with jQuery 1.2, but fails with jQuery 1.3. There are actually two different versions of the plugin; I am currently using this one which is the same as the first but just adds a bit more functionality.
Anyway, I am using Firebug on Firefox 3.0.10 and when I run my code I don't receive any explicit errors, the call is just never returned.
I could obviously continue using v1.2 but would really like to learn why this plugin fails with the latest release and what I can do to get it working.
Thanks in advance.
You should be able to use jQuery's built-in queue support if you're willing to do a bit of legwork.
// First Ajax request
$(document).queue("ajaxRequests", function() {
$.ajax({
// Stuff
success: function() {
$(document).dequeue("myName");
});
});
});
// Second Ajax request
$(document).queue("ajaxRequests", function() {
$.ajax({
// Stuff
success: function() {
$(document).dequeue("myName");
});
});
});
// Trigger the queue
$(document).dequeue("ajaxRequests");
Of course, it would be pretty easy to wrap that in a plugin.
Just found the answer to this looking for a solution myself. Someone decided to modify the original ajaxQueue plugin.
http://www.onemoretake.com/2009/10/11/ajaxqueue-and-jquery-1-3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With