当前位置: 代码迷 >> Ajax >> Ajax Servlet应用 .
  详细解决方案

Ajax Servlet应用 .

热度:272   发布时间:2012-04-27 11:57:44.0
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'])
  相关解决方案