zoukankan      html  css  js  c++  java
  • 【jQuery】Jquery.cookie()

     1 注意:如果不设置path,默认为当前路径,新建cookie
     2 
     3 $.cookie('name', 'value');
     4 
     5 新建带限制时间cookie
     6 $.cookie('name', 'value', { expires: 7 });
     7 新建限制时间和路径cookie,
     8 $.cookie('name', 'value', { expires: 7, path: '/' });
     9 
    10 
    11 读取cookie
    12 $.cookie('name'); // => "value"
    13 $.cookie('nothing'); // => undefined
    14 
    15 读取所有可用cookie$.cookie(); // => { "name": "value" }
    16 
    17 
    18 删除cookie
    19 // Returns true when cookie was successfully deleted, otherwise false
    20 $.removeCookie('name'); // => true
    21 $.removeCookie('nothing'); // => false
    22 
    23 // Need to use the same attributes (path, domain) as what the cookie was written with
    24 $.cookie('name', 'value', { path: '/' });
    25 // This won't work!
    26 $.removeCookie('name'); // => false
    27 // This will work!
    28 $.removeCookie('name', { path: '/' }); // => true

    源:https://github.com/carhartl/jquery-cookie#readme

  • 相关阅读:
    django的模板层
    django的视图层
    django的路由层
    web应用与http协议
    索引
    pymysql模块的使用
    多表查询
    单表查询
    数据的增删改
    自定义form组件
  • 原文地址:https://www.cnblogs.com/oiliu/p/4727324.html
Copyright © 2011-2022 走看看