简体   繁体   中英

jQuery can't read cookie using jquery.cookie plugin

Hy,

I'm developing a website in ASP.NET MVC 5 on my local machine. I'm trying to read a cookie, which I've set by the backend. jQuery and the cookie plugin is included in my code. My code:

var test = $.cookie['test'];

The cookie "test" exist with following properties:

  • Name: test
  • Value: test
  • Domain: localhost
  • Path: /
  • Expires: Session

I've read many posts about issues with cookies, but nothing worked for me.

$.cookie是一个函数,因此您需要调用它(最后使用()),您正在尝试读取一个称为test的属性。

var test = $.cookie('test');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM