Jquery 如何从多维json数组进行迭代

Jquery 如何从多维json数组进行迭代,jquery,json,Jquery,Json,如何通过jQuery迭代JSON返回并返回每个对象的索引 下面是我的一些代码示例: foreach ( x = somevalue ; x < length of array ; x +++ { that x must be the index [0] => Array $('#actual_'+x).text(data.actual+" hrs."); $('#total_'+x).text(

如何通过jQuery迭代JSON返回并返回每个对象的索引

下面是我的一些代码示例:

 foreach ( x = somevalue  ; x < length of array ; x +++
{
            that x must be the index 
         [0] => Array

          $('#actual_'+x).text(data.actual+" hrs.");
          $('#total_'+x).text(data.total+" hrs.");
          $('#regular_'+x).text(data.regular+" hrs.");



}

  (
[0] => Array
    (
        [actual] => 9
        [total] => 10
        [regular] => 0
        [over] => 11
        [total_h] => 11
        [eng_pay] => 148.5
        [rate] => 9
    )

[1] => Array
    (
        [actual] => -1
        [total] => 0
        [regular] => -1
        [over] => 2
        [total_h] => 1
        [eng_pay] => 18
        [rate] => 9
    )

未经测试,但应做到这一点。将此加入到您的成功功能中

$.each($(data), function(i, obj){
   console.log(i); //spits out your index into console
});
varx;对于(x=0;x
——尽管我不得不说这个问题的格式太糟糕了,几乎让人无法理解,所以这是否对你有任何帮助只是猜测。假设您试图回答这个问题-您是否理解Javascript、伪代码和PHP
print\r()
output的随机混合?
$.each($(data), function(i, obj){
   console.log(i); //spits out your index into console
});