I am trying to set a cookie with jQuery 1.7.1:
var global_namesArray = ["Alex", "Bob", "Carmen"];
$.cookie("namesArray", global_namesArray);
I retrieve this cookie like this:
if ($.cookie("namesArray") != null)
global_namesArray = $.cookie("namesArray");
However, the page’s javascript does not load. When I use Firebug to analyze my page, the console reads that $.cookie() is not a function. The error occurs during cookie retrieval I believe. I am sure that I have linked jQuery.
Am I using the jQuery $.cookie() function correctly?
.cookie is not a native function for jQuery. Do you have the cookie plugin installed?
Edit:
I just tested, and I get this error if I include jQuery but not the cookie plugin:
You probably just need to add the cookie plugin.