jquery遍历map的json
后台
Map<String,String> loujing=new HashMap<String,String>();
for(int i=0;i<fileupload.length;i++){
loujing.put("a"+i,"b"+i);
}
JSONObject jsonArray1=JSONObject.fromObject(loujing);
System.out.println(jsonArray1.toString());
结果是:{"a1":"b1","a2":"b2","a3":"b3","a4":"b4"}
然后前台jquery怎么遍历呢???
------解决方案--------------------var json = {"a1":"b1","a2":"b2","a3":"b3","a4":"b4"};
for(var index in json){
alert(index+"-"+json[index]);
}
------解决方案--------------------$.each(data,function(k,v){})