部分前后端代码配置如下
var options = {
type:'post',
datatype:"json",
success:function(data,status,xhr){
alert("上传成功!")
},
error:function(){
alert("上传异常");
}
}; `
后端
response.setContentType("application/json; charset=UTF-8");
response.getWriter().write(json.toString());
调式请求头为
Accept application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
响应头为
Content-Type application/json;charset=UTF-8
可能出问题的点很多,排查方式: