Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Archive for September, 2013

Use of Cookies in jQuery

Posted by Viral Sarvaiya on September 27, 2013


I have already writen that how to use cookies in asp.net and silverlight from below post
https://codesimplified.com/2009/09/10/how-to-createreaddelete-cookies-in-asp-net/
and
https://codesimplified.com/2010/08/27/cookies-in-silverlight/

here i am posting new post that shows how to use cookies in Jquery

Create cookie:

$.cookie('myCookie', 'CookieValue', { expires: 7, path: '/' });

Read cookie:

$.cookie('myCookie'); // => "CookieValue"

Read all available cookies:

$.cookie(); // => { "myCookie": "CookieValue", "...remaining": "cookies" }

Delete cookie:

// Returns true when cookie was found, false when no cookie was found...
$.removeCookie('myCookie');

// Same path as when the cookie was written...
$.removeCookie('myCookie', { path: '/' });

Thanks.

Posted in .Net, ASP.NET, Javascript, Jquery | Tagged: , , , , , | Leave a Comment »

 
%d bloggers like this: