I’m trying to set scores in a cookie with a JSON string…
var json = JSON.stringify({
s:{score:2000,name:"Michael"},
s:{score:1000,name:"Tito"},
s:{score:500,name:"Jackie"},
s:{score:100,name:"Marlon"},
s:{score:10,name:"Jermain"}
});
alert(json);
$.cookies.set('highScores',json,30*24);
The alert is saying:
{"s":"{score":2000,"name":"Michael"}}
…and not the entire object. How do I get the whole object to be a JSON string?