这是我的哈希图和ajax调用
Map<String, List<?>> map=new HashMap<>();
List<?> minimumParameters=new ArrayList<>();
map.put("min", minimumParameters);
map.put("max", maximumParameters);
//this is where i am calling that url and getting response
//now how to iterate that response
$.ajax({
url:'./getMinMaxAvgDataByMtrNo/'+meterNum+'/'+frmDate+'/'+tDate,
type:'GET',
success:function(response){
if(response.length == 0 || response.length == null ){
bootbox.alert("No data for this meter number "+meterNum);
}
else{
alert(response);
}
}
});
现在如何迭代该响应以获取这些列表
答案 0 :(得分:0)
假设您在响应中得到了地图,则可以按照以下方式遍历该地图。使用jQuery
$.ajax({
url:'./getMinMaxAvgDataByMtrNo/'+meterNum+'/'+frmDate+'/'+tDate,
type:'GET',
success:function(response){
if(response.length == 0 || response.length == null ){
bootbox.alert("No data for this meter number "+meterNum);
}
else{
alert(response);
$.each(response , function( key, value ) {
console.log( key + "=" + value ); // min=List<> , can iterate over list if you need to .
});
}
}
});
希望这就是您想要的。