0

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.

2
  • 2
    Just to make sure. Have you included the cookie plugin? Commented Jan 26, 2012 at 19:35
  • What exception? Also, what is the value of document.cookie? Commented Jan 26, 2012 at 19:35

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.