控制器
@ResponseBody
@GetMapping("/ff")
public Map ff() {
Map map = new HashMap();
map.put(11L, "aa");
map.put(22L, "bb");
map.put(33L, "cc");
map.put(44L, "dd");
return map;
}
前端页面
DOCTYPE html>
Title
$(function () {
$.get("/ff", function (res) {
console.log(res)
for (let index in res) {
console.log(index + "\t" + res[index])
}
})
})
结果