Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery.each how to get values from PHP array
    text
    copied!<p>I have following array return from server side:</p> <pre><code>[json] =&gt; Array ( [0] =&gt; {"sEcho":1,"iTotalRecords":"4","iTotalDisplayRecords":"4","bid":"22","aaData":[[1,"Monetary Bid name","12","4.00","6.00","-",".25\/50","-"],[2,"Monetary Bid name","14","5.00","8.00","-","1\/2","-"],[3,"Monetary Bid name","12","87.00","52.56","-","-","-"],[4,"Monetary Bid name","42","22.00","33.00","LH","3\/6","1"]]} [1] =&gt; {"sEcho":1,"iTotalRecords":"2","iTotalDisplayRecords":"2","bid":"23","aaData":[[1,"Second Challenge Bid","12","5.00","4.00","NLH",".10\/.20","1"],[2,"Second Challenge Bid","15","7.00","4.00","PLO",".25\/50","1"]]} [2] =&gt; {"sEcho":1,"iTotalRecords":"0","iTotalDisplayRecords":"0","bid":"24","aaData":[]} ) </code></pre> <p>How can I get/iterate values of this array through jQuery each function.</p> <p>Iam getting following json response:</p> <pre><code> {"sEcho":1,"iTotalRecords":"4","iTotalDisplayRecords":"4","bid":"22","aaData":[[1,"Monetary Bid name","12","4.00","6.00","-",".25\/50","-"],[2,"Monetary Bid name","14","5.00","8.00","-","1\/2","-"],[3,"Monetary Bid name","12","87.00","52.56","-","-","-"],[4,"Monetary Bid name","42","22.00","33.00","LH","3\/6","1"]]}, {"sEcho":1,"iTotalRecords":"2","iTotalDisplayRecords":"2","bid":"23","aaData":[[1,"Second Challenge Bid","12","5.00","4.00","NLH",".10\/.20","1"],[2,"Second Challenge Bid","15","7.00","4.00","PLO",".25\/50","1"]]}, {"sEcho":1,"iTotalRecords":"0","iTotalDisplayRecords":"0","bid":"24","aaData":[]} </code></pre> <p>How can I get values of 'iTotalRecords', 'aaData' etc through each loop. Currently Iam using following loop, but it is returning 'undefined'</p> <pre><code>jQuery(json).each(function(k, v){ alert(json.aaData[k][2]); }); </code></pre> <p>Thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload