controller:
@RequestMapping(value = "/updateToDispatch", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
JS:
$.ajax({
cache : true,
type : "POST",
contentType: "application/json",
url :'http://localhost:5061/yunwei/order/updateToCancel',
data : JSON.stringify({
"workNo":workNo,
"empNo": empNo,
"empName": empName,
"cancelReason": cancelReason
}),
解决方案:
添加:
contentType: "application/json"
data : JSON.stringify()
JSON.stringify() ==> 方法用于将 JavaScript 值转换为 JSON 字符串