0

hey i am new to jquery and using mvc3 with jquery. can anybody tell me how can we clear cookies on all pages from our website on clicking logout button using jquery?

on login button, my code is:

$('.login').click(function(){
    var username = $('#uname').val();
    var password = $('#upass').val();

    $.cookie('username', username, { path: '/' });
    $.cookie('password', password, { path: '/' });
});

i want to clear all cookies in one line code with jquery. can anybody suggest me,how can i do that????

Parasignals
  • 129
  • 1
  • 3
  • 7

1 Answers1

0

To delete a cookie with JQuery, set the value to null:

$.cookie('username', null);
$.cookie('password', null);
palaѕн
  • 72,112
  • 17
  • 116
  • 136