newbie newbie - 4 months ago 25
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.


save that tasty cookie

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

get that sweet cookie back

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