Skip to content

Instantly share code, notes, and snippets.

@robin-drexler
robin-drexler / getCachedJSON.js
Created October 13, 2012 17:17 — forked from k0pernikus/getCachedJSON.js
jQuery.getJSON abstraction to cache data to localStorage with invalidation option based time
jQuery.extend({
getCachedJSON: function (url, callback) {
var cacheTimeInMs = 3600000;
var currentTimeInMs = new Date().getTime();
var cache = {
data:null,
timestamp:null
};