1、返回map集合数据
后台数据:
public Object selectAllInfo() { HashMap map = new HashMap(); return map; }
前端:
$.ajax({ type : 'POST', url : 'conte/selectAllInfo.do', data : { }, dataType : 'json', success : function(data) { }, error : function(data) { console.log(data.(key值)) } });
2、返回list<map<String,Object>>集合数据
后台:
public Object getAll(){ List<Map<String,Object>> maps=new ArrayList<>(); return maps; }
前端:
$.ajax({
type : 'POST',
url : 'conte/selectAllInfo.do',
data : { },
dataType : 'json',
success : function(data) {
$.each(data,function (i,item) {
console.log(i+":::"+item);
if (i=="error"){
toastr.warning(item);
}
else { if (i=="Map里面的key值"){
}
},
error : function(data) {
console.log(data.(key值))
} });