jquery cookie set value to boolean true

后端 未结 4 1207
太阳男子
太阳男子 2020-12-17 21:16

I am using this jquery.cookie plugin and I need to set value to TRUE or NULL/FALSE.

I am trying to do it like this: $.cookie(\'ff\', true, { expires: 30, path:

4条回答
  •  太阳男子
    2020-12-17 22:08

    Cookies are only string-valued. As gdoron commented, if you want to treat the value as a boolean, you need to parse it back to a boolean when the cookie value is read back out.

    Since you commented that you are reading the cookie value with PHP, see Parsing a string into a boolean value in PHP.

提交回复
热议问题