Skip to content
A jQuery plugin to memoize Ajax calls
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
README.md
jquery.cachedAjax.js

README.md

cachedAjax

v0.0.1
01/27/2011

About

A jQuery plugin to set up memoized Ajax calls to improve performance when fetching static resources via Ajax.

Call the function via jQuery.cachedAjax and supply it with a configuration object that you would normally use with jQuery.ajax (save for the data). It then returns a function that you call with a data object every time you wish to make a request.

Example usage:
var search = jQuery.cachedAjax({ url : '/search', type : 'get', success : function(data) { console.log(data); } });

When you call search({ q : "test" }) an Ajax request is made. If it is successful, the result is stored in an array and your success callback is triggered with the data (with only the data). A repeated call of search({ q : "test" }) will simply call the success callback with the data stored in the array, no Ajax call is needed.

To clear the cache, simply call search.clearCache()

For more visit the project site.

Something went wrong with that request. Please try again.