I need to pass some variables from a cookie to jQuery, but I got this result:
a:2:{s:4:"wait";s:3:"600";s:2:"ip";i:168427521;}
Which is serialized, how I can access to these variables from jQuery?
Edit: I’ve updated my code: now I got this:
console.log(cookie);
and prints:
{"wait":"600","ip":168427521}
how I can access those variables?
Answer
var obj = jQuery.parseJSON(cookie); console.log(obj.wait,obj.ip);`