Reputation: 22323
i create a cookie and use it like this.inside a document.ready
document.cookie = $('#rdb1').attr("id");
check = document.cookie.split(';');
flag = check[0];
But unable to erase cookies.I found this function.
function Delete_Cookie( name, path, domain )
{
if ( Get_Cookie( name ) )
document.cookie=name+"="+((path) ? ";path="+path:"")+((domain)?";domain="+domain:"") +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
on javascript - delete cookie.But unable to use this function in my situation.Any idea how to deal with this.Thanks.
Upvotes: 1
Views: 1325
Reputation: 7583
If you are using jQuery cookie, you might want to try just setting the cookie to null, like this:
$.cookie("name", null);
There was a similar question about it found here: jquery, delete cookies .
Note: when deleting a cookie, you must pass the exact same path, domain and secure options that were used to set the cookie.
To set the path for a cookie, you could use something like this:
$.cookie("name", null, { path: '/' });
Upvotes: 1
Reputation: 402
I use this jquery plugin (very simple =P).
https://github.com/carhartl/jquery-cookie
Upvotes: 0