0
如何通过jQuery迭代JSON返回并返回每个对象的索引?一些下面我的代码如何从multidimention迭代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
)
)
我想通过这个jQuery AJAX控件的成功功能遍历:
$.ajax({
type:'POST',
url: 'cal_grid.php',
dataType: 'json',
cache: false,
data:$('#grid_frm').serialize(),
success: function(data)
{
alert(data);
} // response call back ends
});//ajax call ends
'var x;对于(x = 0; x
DaveRandom
对不起... –