nmford
nmford

Reputation: 1014

jQuery $.cookie throwing an exception

I have a jQuery Ajax request through which I'm trying to send a CSRF token name stored in a cookie.

When trying to access the cookie, my JS is throwing up an exception.

This is the guilty line of code:

var token = $.cookie("csrf_cookie_name");

I've verified that the cookie does exist by going into my browser preferences and looking at the saved cookies for the domain and for the life of me can't figure out why that line of code is causing an exception.

Upvotes: 0

Views: 183

Answers (1)

NeoNexus DeMortis
NeoNexus DeMortis

Reputation: 1326

Taking a wild guess, I would assume that you are not using a plugin for jQuery.cookie. jQuery it self does NOT have a cookie function, however, there is a cookie plugin for jQuery.

I recommend checking out this site, as it should help you fix your problem: http://www.electrictoolbox.com/jquery-cookies/

Upvotes: 1

Related Questions