var cache = {
obj : {
"key" : "value",//sample:"001":"lily"
}
}
var app = {
updateCache : function(id) {
var onSuccess = function() {
cache.obj[id] = "your_new_value"//save new id,new value
}
if (cache.obj[id] === undefined) {
$.ajax({
success : onSuccess
})
} else {
alert("get cache data:"+cache.obj[id]);
}
}
}
$(app.updateCache("200"));