我想在页面中缓存以下
JSON对象,以便我可以在另一个页面上检索它.
var test = { "lists":["list1","list2","list3","list4","list5"],"maps": { "key4":"value4","key3":"value3","key5":"value5","key2":"value2","key1":"value1" },"number1":123456789,"numberarray1":[1,2,3,4,5,6,7,8,9],"string1":"A","stringarray1":["A1","B1"] }
如何缓存并重新检索?
这可能吗?如果没有其他方法可以保存我的JSON对象,然后在另一个页面上检索它.
谢谢.
解决方法
保存美味的饼干
$.cookie("test-data",JSON.stringify(test));
得到那甜蜜的回味
var test = JSON.parse($.cookie("test-data"));