-2
使用该代码来访问JSON数组的元素:遍历JSON给出错误
var json = "{\"noteDetailList\": [ {\"linkName\": \"test1\"}]}"
$.each(json, function() {
console.log(data)
});
迭代给出了这样的错误:
Uncaught TypeError: Cannot use 'in' operator to search for '43' in {"noteDetailList": [ {"linkName": "test1"}]} jquery-1.11.0.js:592isArraylike jquery-1.11.0.js:592jQuery.extend.each jquery-1.11.0.js:359(anonymous function) (index):24jQuery.event.dispatch jquery-1.11.0.js:4624elemData.handle jquery-1.11.0.js:4292
拨弄:
http://jsfiddle.net/rsv0tn5e/1/
我的迭代不正确吗?