I am getting my JSON string as:
newStr = { total:"1", page:"1", records:"2", rows: [<li>a</li><li>b</li>] }.
jQuery("#list").addJSONData(JSON.parse(newStr));
I am getting my JSON string as:
newStr = { total:"1", page:"1", records:"2", rows: [<li>a</li><li>b</li>] }.
jQuery("#list").addJSONData(JSON.parse(newStr));
You are trying to parse something that is not a string. This will implicitly call toString
on the object, and you get the string [object Object]
, which is not valid JSON.
Either parse a string:
newStr = '{"total":"1","page":"1","records":"2","rows":["<li>a</li>", "<li>b</li>"]}';
jQuery("#list").addJSONData(JSON.parse(newStr));
or use the object:
newStr = { total:"1", page:"1", records:"2", rows: ["<li>a</li>", "<li>b</li>"] };
jQuery("#list").addJSONData(newStr);
You are trying put a json data as Json data,remove JSON.parse it will work