Robert Jaskowski
Robert Jaskowski

Reputation: 823

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:

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

Upvotes: 0

Views: 1186

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

$.cookie is a function so you need to invoke it(by using () at the end), you are trying to read a property called test

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

Upvotes: 5

Related Questions