我有一个从 php 函数返回的数据,如下所示:
data[0]
[0]
<table>
....
</table>
[1]
<table>
....
</table>
.
.
.etc
data[1]
我如何通过 javascript 遍历这个数组!
最佳答案
嵌套 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>
});
});
关于php - 循环遍历多维数组jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11190328/