啥也不错了,直接贴代码
$("#resize").click(function(){
$.ajax({
type:"GET",
url:"../report/countByType.json?type=0&userName=nbws004",
dataType:"json",
success:function(d){
var person=d.person;//person是一个map,转化为一个数组,如果是list也是相同的
for(i in person){
$("#1").append(" "+i+": "+person[i]);//输出数组下标和值
}
$("#2").append(d.person.name+" "+d.person.age+" "+d.person.gender);//根据key得到value
}
});
<body>
<div id="1" ></div>
<div id="2" ></div>
</body>
--------------------------------------
结果:
<div id="1" >age: 23 name: zp gender: male</div>
<div id="2" >zp 23 male</div>