If you want to avoid sending the request, you'll have to do that yourself.
window.ajaxCache = {};
// later on:
if (!window.ajaxCache["/nba/value_charts/" + site_id + "/" + t_date]) {
window.ajaxCache["/nba/value_charts/" + site_id + "/" + t_date] = $.get("/nba/value_charts/" + site_id + "/" + t_date);
}
window.ajaxCache["/nba/value_charts/" + site_id + "/" + t_date].done(function( html ) {
$("#vr").html(html)
$(".value-charts").tablesorter();
});
All cache: true does is avoid setting a _ parameter to prevent caching, allowing the browser to cache it just like it would an image, assuming the server is returning headers that tell the browser to cache it.
this is easy enough to abstract behind a function:
getCachableData = (function(){
var ajaxCache = {};
return {
get: function(url) {}
if (!ajaxCache[url]) {
ajaxCache[url] = $.get(url);
}
return ajaxCache[url];
},
clear: function(url) {
if (url) {
ajaxCache[url] = false;
}
else {
ajaxCache = {};
}
}
};
})();
// later on...
getCachableData.get("/nba/value_charts/" + site_id + "/" + t_date).done(function(html){
$("#vr").html(html)
$(".value-charts").tablesorter();
});