| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
10年前发布

操作cookie的jQuery插件:jquery.cookie

一个简单,轻量级的jQuery插件用于读取,写入和删除cookie。

Usage

Create session cookie:

$.cookie('name', 'value'); 

Create expiring cookie, 7 days from then:

$.cookie('name', 'value', { expires: 7 }); 

Create expiring cookie, valid across entire site:

$.cookie('name', 'value', { expires: 7, path: '/' }); 

Read cookie:

$.cookie('name'); // => "value" $.cookie('nothing'); // => undefined 

Read all available cookies:

$.cookie(); // => { "name": "value" }

Delete cookie:

// Returns true when cookie was successfully deleted, otherwise false  $.removeCookie('name'); // => true  $.removeCookie('nothing'); // => false    // Need to use the same attributes (path, domain) as what the cookie was written with  $.cookie('name', 'value', { path: '/' });  // This won't work!  $.removeCookie('name'); // => false  // This will work!  $.removeCookie('name', { path: '/' }); // => true

项目主页:http://www.open-open.com/lib/view/home/1410180217586

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1410180217586.html
jQuery Ajax框架 jquery.cookie