newbie newbie - 1 year ago 73
jQuery Question

Cache JSON object using jquery and retrieve it

I want to cache the following JSON object in the page so that I can retrieve it on another page.

var test = {
"maps": {

How do I cache it and retrieve it again?

Is this possible? If not are there other ways that I can save my JSON object and then retrieve it on another page.

Thank you.

Answer Source

save that tasty cookie

$.cookie("test-data", JSON.stringify(test));

get that sweet cookie back

var test =  JSON.parse($.cookie("test-data"));

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download