This is the code that I've got:
var tmp_kana_type = "hiragana";
var tmp_kana_set = "monographs";
cookie_symbols = {"symbols": []};
for (kana_row=0; kana_row<10; kana_row++) {
for (kana_column=0; kana_column<5; kana_column++) {
var tmp_JSON = {
"kana_type": tmp_kana_type,
"kana_set": tmp_kana_set,
"kana_row": kana_row,
"kana_column": kana_column,
"selected": 0,
"correct": 0,
"total": 0
};
cookie_symbols.symbols.push(tmp_JSON);
}
}
console.log(cookie_symbols); // works
var to_string = JSON.stringify(cookie_symbols);
console.log(to_string); // works
var to_json = JSON.parse(to_string);
console.log(to_json); // works
$.cookie("test_cookie1", "test string");
console.log($.cookie("test_cookie1")); // works
$.cookie("test_cookie2", JSON.stringify(cookie_symbols)); // does not work (why?)
console.log($.cookie("test_cookie2")); // does not work (null)
console.log(JSON.parse($.cookie("test_cookie2"))); // does not work (null)
JSON.stringfy() is not working with $.cookie() while I believed it should. Did I do something wrong, and how do I fix or make this work? I found this answer, and it's pretty much what I did too, but in my case it doesn't work for some reason. I am using this jQuery cookie plugin.
I believe is your main issue is that you've exceed the maximum cookie file size.