您当前的位置: 首页 >  Java

梁云亮

暂无认证

  • 2浏览

    0关注

    1211博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

JavaScript遍历Controller 返回的Map

梁云亮 发布时间:2022-09-13 16:44:43 ,浏览量:2

控制器
@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])
            }
        })
    })




结果

在这里插入图片描述

关注
打赏
1665409997
查看更多评论
立即登录/注册

微信扫码登录

0.0461s