3

我有一个从 php 函数返回的数据,如下所示:

data[0]
     [0]
       <table>
        ....
       </table>
     [1]
       <table>
        ....
       </table>
       .
       .
       .etc
 data[1]

我怎样才能通过javascript循环这个数组!

4

1 回答 1

5

可以有一个嵌套的jQuery foreach 函数。

$.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>
  });
});
于 2012-06-25T14:06:37.053 回答