Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting ('true', 'false' or 'null')
报错原因:发送的 json object 不符合 json 规范,后台无法解析。(Ajax跨域问题?)
解决方法:
ajax提交添加下面两行代码
contentType:‘application/json;charset=utf-8‘
data:JSON.stringify(数据)
var allData = {
name:"张三",
age:20
};
$.ajax({
type: "POST",
url: "xxxx",
contentType:‘application/json;charset=utf-8‘,
data:JSON.stringify(allData),
success: function (data) {
alert(data);
}
});
http://www.mamicode.com/info-detail-1721637.html
浙公网安备 33010602011771号