AJAX Queue/Cache/Abort/Block Manager v. 2.0

Helps you to manage AJAX requests and responses (i.e. abort requests, block requests, order requests). It is inspired by the AJAX Queue Plugin and the AjaxQueue document in the jQuery-Wiki.

$.manageAjax.create (uniqueName, options)

Creates a new ajaxmanager and returns it. Takes a list of options:

Your constructed ajaxmanager knows three methods:

Example:

//create an ajaxmanager named cacheQueue var ajaxManager = $.manageAjax.create('cacheQueue', { queue: true, cacheResponse: true }); //and add an ajaxrequest with the returned function ajaxManager.add({ success: function(html) { $('ul').append('<li>'+html+'</li>'); }, url: 'test.html' });

or only with the uniqueName parameter

//generate an ajaxmanger named clearQueue $.manageAjax.create('clearQueue', {queue: 'clear', maxRequests: 2}); //and add an ajaxrequest with the name parameter $.manageAjax.add('clearQueue', { success: function(html) { $('ul').append('<li>'+html+'</li>'); }, url: 'test.html' });

Demo:

Tip: Open your Firebug-Console, log the XHR´s and click around.

{queue: true}

0 secound delay | 1 secound delay | 2 secounds delay | 3 secounds delay |

{queue: 'clear', maxRequests: 2, abortOld: true}

0 second delay | 1 second delay | 2 seconds delay | 3 secounds delay |

{queue: 'clear', cacheResponse: true}

0 second delay | 1 second delay | 2 seconds delay | 3 secounds delay |

{queue: false, cacheResponse: true, preventDoubbleRequests: false}

0 second delay | 1 second delay | 2 seconds delay | 3 secounds delay |

If you find bugs please report them!!!

Project Site & Bugtracker

Download

Licenses

Older version of the ajaxmanager (slightly different API)

Back to protofunc