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.
精彩评论