How do I go about getting the Ajax Queue plugin working in jQuery 1.3?

前端 未结 3 1061
醉梦人生
醉梦人生 2020-12-13 03:16

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 gr

相关标签:
3条回答
  • 2020-12-13 03:28

    ajaxManager plugin is based on the Ajax Queue Plugin but is a bit more flexible and works with jQuery 1.3.2.

    0 讨论(0)
  • 2020-12-13 03:33

    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.

    0 讨论(0)
  • 2020-12-13 03:52

    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/

    0 讨论(0)
提交回复
热议问题