I have Json of the form
[{"id":39,"data":1},{"id":40,"data":2}]
这个数据无法通过 jQuery.parseJSON()
正确解析。
我需要将这个数据转换为 HTML table
。我考虑在 JS 中动态创建 HTML。
A. 如何解析这个 JSON 数据?
B. 动态创建 HTML 是否是最佳方式?
更新
抱歉,我的问题显然不太清楚。下面是 jQuery 代码:
$.get('Service.aspx',
{ p1: value, p2: value },
function (data) {
notesJson = data;
alert(notesJson);//Json comes back as I said here...
var noteSet = jQuery.parseJSON(notesJson);
alert(noteSet.notes);
});
Json中存在注释。第二个警告失败,显示“未定义”。