views:

35

answers:

1

I have made pagination with jQuery and now I would like to save the selected state/page to cookie. I would need to save tab-id, offset and limit values.

I know that I can write to cookie like this:

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

And then read it:

$.cookie("example");

But how I can save all those three thing into cookie? And especially read it?
For example, if I need to know just the tab-id value from the cookie, how can I get that if I have multiple values in cookie?

Also all help/info on how to do a saving page state (pagination) is appreciated.

And jQuery site is down, I checked that first
:p Thanks.

+1  A: 

You can either set 3 different cookies, or create a JSON object and store that string as your one cookie.

Coach John
I have no clue how to create JSON object. Any good examples anywhere?
Thom Eriksson
Read this: http://api.jquery.com/jQuery.getJSON/ It tells a bit about jow jQuery works with JSON, and theres a really simple example there that actually is kind of close to what you'd want to do.
Coach John