【发布时间】:2021-07-20 12:53:14
【问题描述】:
-
ajax调用接口返回的数据顺序不正确。如果key为字符串,则正确,key为数字顺序。
-
postman调用接口返回的数据是正确的。
{
"3": "3#",
"4": "4#",
"5": "5#",
"2": "2#",
"1": "1#"
}
- ajax 代码
$.ajax({
type: "get",
url: 'xxx/xxx/xxxx',
async: false,
success: function (result) {
console.log(result.data)
}
})
- ajax 结果
{
1: "1#",
2: "2#",
3: "3#",
4: "4#",
5: "5#"
}
- 后台使用springboot,返回LinkedHashMap
【问题讨论】:
标签: jquery spring-boot linkedhashmap