在前端通过ajax请求后台之后返回的时候,出现了下面的异常:
error: function(xhr,errorText,errorType){}
req:
textStatus:"parsererror";
errorThrown:undefined.
而自己的ajax请求如下:
$.ajax({
type: 'POST',
contentType: 'application/json',
data: $('form').serialize()
url: "url",
async: false,
dataType: 'json',
success:function(res.stutas){},
error:function(xhr,errorText,errorType){}
)}
解决方案:将dataType注释掉就可了,原因是我的返回值是一个字符串而不是一个对象~~