hello,
i have some json data returned from a form. my question is how do i save it into a cookie?
the "testForm" is just a form and all the data is transformed into json format and put into "testArea".
here is my code:
- function test()
{
var formData = form2object('testForm');
document.getElementById('testArea').innerHTML = JSON.stringify(formData, null, '\t');
} - <pre><code id="testArea">
</code></pre>
i was thinking to use something like:
- var value = JSON.stringify(formData, null, '\t');
$.cookie('cookie', 'value');
but i'm getting stuck.
All help will be appreciated.
thanks
re:
i figure it out:
- var value = JSON.stringify(formData, null, '\t');
$.cookie('cookie',value,{json:true});