I have one function use for writing cookie :
function Search_Click() {
$.cookie("urlAction", null);
$.cookie("searchKey", null);
var searchkey = $('#txtsearch').val();
var key = decodeURIComponent(searchkey);
sampleData = "Q=" + key;
if ($.cookie("urlInStock") != null) {
action = "NewSearchIn";
} else {
action = "NewSearch";
}
urlAction = "Pro/" + action + "/";
$.cookie("searchKey", sampleData);
$.cookie("urlActionVal", urlAction);
window.location = "/Pro?tab=2";
}
After Search_Click()
is done, the page will redirect to another page with the cookie that I just registered.
Then if a user click on a link, I would like to delete that cookie.
This is what I tried :
function deleteSearchCookies() {
$.cookie("searchKey", null);
$.cookie("urlActionVal", null);
}
But when I bug in FireBug, the session still exist.