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 に答える