actions in Jquery.cookie:
Jquery.cookie.js is a jquery based plugin, click Download.
Create a session cookie:
$.cookie (' cookiename ', ' cookievalue ');
Note: When no cookie time is specified, the cookie that is created is known as the session cookie by default to the user's browser shutdown.
To create a persistent cookie:
$.cookie (' cookiename ', ' Cookievalue ', {expires:7});
Note: When the time is specified, it is called a persistent cookie and the valid time is days.
Create a cookie that is persistent and with a valid path:
$.cookie (' cookiename ', ' Cookievalue ', {expires:7,path: '/'});
Note: If you do not set a valid path, by default, only the path to read the Cookie,cookie on the cookie Settings current page is used to set up a top-level directory that can read cookies.
Create a cookie that is persistent and with a valid path and domain name:
$.cookie (' cookiename ', ' Cookievalue ', {expires:7,path: '/', Domain: ' chuhoo.com ', secure:false,raw:false});
Note: domain: Create the name of the Web page owned by the cookie; secure: Default is False, if the transport protocol for True,cookie is Https;raw: Default is False, Automatic encoding and decoding when reading and writing (using encodeURIComponent encoding, decoding using decodeuricomponent), turn off this feature, set to true.
Get Cookies:
$.cookie (' cookiename '); Returns Cookievalue if present, otherwise null is returned.
To delete a cookie:
$.cookie (' cookiename ', null);
Note: If you want to delete a cookie with a valid path, the following:
$.cookie (' CookieName ', Null,{path: '/'});