create, read, and erase cookies with jquery [duplicate]

Set a cookie

$.cookie("example", "foo"); // Sample 1
$.cookie("example", "foo", { expires: 7 }); // Sample 2
$.cookie("example", "foo", { path: '/admin', expires: 7 }); // Sample 3

Get a cookie

alert( $.cookie("example") );

Delete the cookie

$.removeCookie("example");

Comments

Popular posts from this blog

What is the difference between asynchronous and synchronous execution?

Yahoo accepting requests for inactive email IDs

How to install JDK 1.7.0 and how to set path and classpath variables