I'm currently using jQuery cookie for a button
$('.vote').one('click', function(){
var cookieid = ($(this).data("id")); //cookie name
alert ($.cookie(cookieid)); //..etc
This gives me a textbox saying "undefined". However, I do know that the variable cookieid is assigned, as alerting the variable gives me a value.
Furthermore, this script works fine if I use a 'cookieid' that I know I have assigned. For instance, I have a cookie named 17. When I alert ($.cookie('17')); everything works correctly.
I'm pretty sure the problem is not in my end of the code, so can jQuery cookie not handle variables?
Edit:
//creating cookie if none already exists
var cookieid = ($(this).data("id")); //cookie name
if ($.cookie(cookieid) == 'active') //if cookie exists
{
//do nothing
}
else
{
$.cookie(cookieid, 'active');
}