jquery cookie使用

来源:互联网 发布:淘宝秒刷销量软件 编辑:程序博客网 时间:2024/06/15 13:27

jquery.cookie.js 提供了jquery中非常简单的操作cookie的方法。

  • $.cookie('the_cookie'); // 获得cookie
  • $.cookie('the_cookie', 'the_value'); // 设置cookie
  • $.cookie('the_cookie', 'the_value', { expires: 7 }); //设置带时间的cookie
  • $.cookie('the_cookie', '', { expires: -1 }); // 删除
  • $.cookie('the_cookie', null); // 删除 cookie
  • $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});//新建一个cookie 包括有效期 路径 域名等