Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loop through multi dimensional array jquery

i have an returned data from an php function as the following :

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

how can i loop through this array by javascript !

like image 829
uno-2017 Avatar asked Sep 08 '26 17:09

uno-2017


1 Answers

It would be possible to have a nested 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>
  });
});
like image 199
Fermis Avatar answered Sep 11 '26 06:09

Fermis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!