1.

记得加入SpringJSON解析包,否则spring无法将返回的pojo类解析成json数据

maven则加上下面的依赖包

<!--    SpringJSON解析包-->
<jackson.version>2.9.9</jackson.version>
.
.
.
.
.
.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>

2.
记得将数据类型改为
dataType: 'json',
否则只能把返回data识别为字符串,无法通过data.xxx获取属性参数

spring的返回json数据给前端注意事项

 

 







相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2021-08-15
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2022-12-23
  • 2022-03-03
相关资源
相似解决方案