$.post({
url: "/register",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(info),
success: function (data) {
}
});
必须包含:
dataType: "json",
contentType: "application/json", 不加后端会出现415错误
spring boot代码如下
@PostMapping("/register") @ResponseBody public String register(@RequestBody JSONObject info) { return null; }
必须加@RequestBody 不然出现 500错误