How to save multiple variable data into one cookie using jQuery

I did pagination using jQuery and now I would like to save the selected state / page to a cookie. I would need to keep tab-id , offset and limit values .

I know that I can write to a cookie as follows:

$.cookie("example", "foo");

And then read it:

$.cookie("example");

But how can I store all these three things in a cookie? And especially read? For example, if I only need to know the tab id value from a cookie, how can I get this if I have multiple cookie values?

All help / information on how to make a saved page state (pagination) is also welcome.

And jQuery site is off, I checked that first
: p Thank you.

+3
source share
1 answer

You can either set 3 different cookies, or create a JSON object and save this line as your one cookie.

+2
source

Source: https://habr.com/ru/post/1763863/


All Articles