2010-03-09 68 views
1

jQuery的刪除的cookie我使用這個插件來存儲一些餅乾:使用Cookie插件

https://code.google.com/p/cookies/wiki/Documentation

我想知道我怎麼會去刪除所有Cookie具有一定的前綴和/或刪除所有Cookie是有一定的價值。一旦有用戶通過我的應用程序完成了他的旅程,我需要這樣做。

例如,我存儲某些表的可見狀態頁面上,像這樣:

// check visible status of table and persist 
$('div.dependant').each(function(){ 

    var $childCount = $(this).index('div.dependant'); 

    $(this).addClass('tableStatus' + $childCount); 

    // get the value of the cookie 
    var $tableStatus = $.cookies.get('tableStatus' + $childCount); 

    // if variable not null 
    if ($tableStatus) { 
     if ($tableStatus == 'hidden') { 
      $('.tableStatus' + $childCount).hide();    
     } else if ($tableStatus == 'visible') { 
      $('.tableStatus' + $childCount).show(); 
     } 
    } 

}); 

這樣cookies會「tableStatus0」,「tableStatus1」等等......

我能手動刪除但會有不明數量的表格。

回答

相關問題