Lalit Patel wrote JavaScript Library that helps to use JSON to store data in cookies.
The nice library is built on top of Prototype and gives you a simple API to put and get JSON values into cookies.
Full information and download:
Yummy JSON Cookies (using Prototype)
Code Example:
var jar = new CookieJar({
expires:3600, // seconds
path: '/'
});
var dog = {name: 'Jacky', breed: 'Alsatian', age:5};
jar.put('mydog', dog);
mydog = jar.get('mydog');
alert("My dog's name is " + mydog.name);
alert("He is " + mydog.age + " years old");
alert("He is an " + mydog.breed);
Enjoy :-)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment