I've got this piece of jquery code that accesses a url via get and inserts the data to a container. How can I change it to actually cache the requested url and the returned data, so it won't load the url all over again if it's called more than once, but instead serve the cached data?
This is the code
_loadAjaxContents = function (href) {
var dfr = new $.Deferred();
$.get(href, function (data) {
self.$expanderInner.html(data);
dfr.resolve();
});
return dfr.promise();
}