Nov 3, 2018

Set / Get / Delete Web Site cookie by JQuery

Using JQuery COOKIE plugin

Set a cookie

$.cookie("example", "i88ca"); // example 1
$.cookie("example", "i88ca", { expires: 88 }); // example 2
$.cookie("example", "i88ca", { path: '/user', expires: 88 }); // example 3

Get a cookie

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

Delete the cookie

$.removeCookie("example");
// or  
$.cookie('bas_referral', null);