jQuery.cookie  function     

Cookie plugin

Copyright (c) 2006 Klaus Hartl (stilbuero.de)
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html

Create a cookie with the given name and value and other optional parameters. / Get the value of a cookie with the given name.

Quick Examples

Set the value of a cookie.

 * $.cookie('the_cookie', 'the_value');

Create a cookie with all available options.

 $.cookie('the_cookie', 'the_value',
 { expires: 7, path: '/', domain: 'jquery.com', secure: true });

Create a session cookie.

 $.cookie('the_cookie', 'the_value');

Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain used when the cookie was set.

 $.cookie('the_cookie', null);

Get the value of a cookie.

 $.cookie('the_cookie');
$.cookie(name, value, options, expires, path, domain, secure) -> String
{optional:String}

The name of the cookie.

{optional:String}

The value of the cookie.

{optional:Object}

An object literal containing key/value pairs to provide optional cookie attributes.

{optional:Number|Date}

Either an integer specifying the expiration date from now on in days or a Date object. If a negative value is specified (e.g. a date in the past), the cookie will be deleted. If set to null or omitted, the cookie will be a session cookie and will not be retained when the the browser exits.

{optional:String}

The value of the path atribute of the cookie (default: path of page that created the cookie).

{optional:String}

The value of the domain attribute of the cookie (default: domain of page that created the cookie).

{Boolean}

If true, the secure attribute of the cookie will be set and the cookie transmission will require a secure protocol (like HTTPS).

{String}

or {undefined} when setting the cookie.

© Jupiter IT - JavaScriptMVC Training and Support