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

Ajax Servlet应用 在线等....
Ajax异步调用servlet 返回数据如下  
[
  [{"gameid":3,"gameimg":1,"gamename":"阿凡龙","gametype":"A"}],
[{"gameid":4,"gameimg":1,"gamename":"霸王","gametype":"B"}],
[{"gameid":5,"gameimg":1,"gamename":"传说","gametype":"C"}],
[{"gameid":6,"gameimg":1,"gamename":"大话西游3","gametype":"D"}, {"gameid":7,"gameimg":1,"gamename":"刀剑","gametype":"D"}]
]

//
function getData(one,two,three,four){
$.ajax({
url:"GetGametableByGametypeidServlet",
type:"post",
data:{"one":one,"two":two,"three":three,"four":four},
dataType:"json",
success:function(data){
$.each(data,function(key,obj){
alert(obj['gamaname'])
});
}
});
}


如何迭代出来数据啊...

------解决方案--------------------
alert(obj['gamaname'])
改成

alert(obj[0]['gamename'])