0
有誰知道在cookie中存儲信息的強大類嗎?在cookies中存儲信息
我只想寫類似:
var cookieStorage = new cookieStorage(100); // 100 - time to store data
var apple = {size:10, color:'red',weight:100};
cookieStorage.set('MyApple',apple);
var restoredApple = cookieStorage.get('MyApple');
我實現(無時間來存儲)
var cookieStorage = {
set: function (key, value) {
$.cookie(key, $.toJSON(value));
},
get: function (key) {
var json = $.cookie(key);
return $.parseJSON(json);
}
}
Here是餅乾插件