Josh Josh - 1 year ago 54
Javascript Question

How to store an array in a JavaScript cookie?

Does anyone have a piece of JavaScript code that creates a cookie and stores an array in it? If you also have the code to read through through cookie and delete it, that would be great as well. Thanks!

Answer Source

have a look at:

to store an array

$.cookie('COOKIE_NAME', escape(myarray.join(',')), {expires:1234});

to get it back