开发者

Jquery cookies problem

开发者 https://www.devze.com 2023-01-20 05:56 出处:网络
I\'m using cookie plugin with jquery. I set cookie like $.cookie(\'key\',开发者_StackOverflow中文版\'value\'). In firebug I can see that the cookie is set but console.log($.cookie(\'key\')) returns nu

I'm using cookie plugin with jquery. I set cookie like $.cookie('key',开发者_StackOverflow中文版'value'). In firebug I can see that the cookie is set but console.log($.cookie('key')) returns null.

What am I doing wrong ?


Try adding more parameters, only for testing:

$.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com' });

To verify the value of the cookie, you can also use the Web Developer Extension, they have an option for view cookies.

0

精彩评论

暂无评论...
验证码 换一张
取 消