2011-04-05 74 views
1

我有一個我想要閱讀的cookie,然後從它的小部件ID中刪除一個條目。JQuery - 從cookie中刪除條目

if (thisWidgetSettings.removable) { 
      $('<a href="#" class="remove">CLOSE</a>').mousedown(function (e) { 
       /* STOP event bubbling */ 
       e.stopPropagation();  
      }).click(function() { 
       if(confirm('This widget will be removed, ok?')) { 

     $.ajax({ 
      type: "get", 
      url: "/controllers/widget.php", 
      data: { 
       method: "remove", 
       widgetID:thisWidget.id, 
        }, 
        dataType: "json", 

       }); 

     var mycookie = $.cookie("mypreferences"); 

//根據ID這裏


的建議刪除...

VAR cookieName = '的myCookie'; var cookie = $ .cookie(「preferences」);

     var cookie = cookie.split('|'); 

         $(cookie).each(function(index){ 

           var thisCookieData = this.split(','); 


          alert(thisCookieData); 


           }); 

回答