Jquery Cookie plugin - multiple values?

后端 未结 4 516
长情又很酷
长情又很酷 2020-12-18 00:18

I am using popular jquery Cookie plugin https://github.com/carhartl/jquery-cookie Wonder how to set and read a cookie with multiple values? Or maybe it\'s possible to add/re

4条回答
  •  暖寄归人
    2020-12-18 01:09

    Try this one: https://github.com/tantau-horia/jquery-SuperCookie

    Quick Usage:

    create - create cookie

    check - check existance

    verify - verify cookie value if JSON

    check_index - verify if index exists in JSON

    read_values - read cookie value as string

    read_JSON - read cookie value as JSON object

    read_value - read value of index stored in JSON object

    replace_value - replace value from a specified index stored in JSON object

    remove_value - remove value and index stored in JSON object

    Just use:

    $.super_cookie().create("name_of_the_cookie",name_field_1:"value1",name_field_2:"value2"});
    $.super_cookie().read_value("name_of_the_cookie","name_field_1");
    

提交回复
热议问题