我从php函数返回的数据如下:
data[0]
[0]
<table>
....
</table>
[1]
<table>
....
</table>
.
.
.etc
data[1]
如何通过javascript循环遍历此数组!
答案 0 :(得分:5)
可以使用嵌套的jQuery foreach function.
$.each(data, function(key, value) {
//this is each data... data[0], data[1]... etc, the value being value and the index being key.
$.each(key, function(innerKey, innerValue){
//this is where your tables are. innerKey being the index innerValue being the value.
<table>
...
</table>
});
});