日期:2014-05-16  浏览次数:20300 次

jquery遍历json的方法
json的数据为:{"0":["75","test4","test41","ddd"],"1":["76","test5","test51","ddd"]}
需要在jquery中进行遍历,
请教
如何获取数组中第三个的数值,即遍历后得到test41和test51的值

------解决方案--------------------
JScript code
var j ={"0":["75","test4","test41","ddd"],"1":["76","test5","test51","ddd"]}
var arr= [];
$.each(j,function(i,o){
    arr.push(o[2])
})
alert(arr)

------解决方案--------------------
JScript code

     var json = { "0": ["75", "test4", "test41", "ddd"], "1": ["76", "test5", "test51", "ddd"] };
     for(k in json ){
         alert(json[k][2]);
     }