传参数,后台@RequestBody接收实体,报错:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
解决方案:添加**的内容,既可以解决问题
function saveProjectSalary() {
$.ajax({
url: '<%=basePath%>/projectSalary/saveProjectSalary',
type: 'post',
**data: JSON.stringify($("#projectSalaryForm").serialize()),**
**contentType:"application/json",**
dataType: "json",
success: (result) => {
if (result.code == '200') {
alert(result)
}
},
error: (e) => {
alert(e);
}
});
}
网友评论