$.ajax({
type: "json",
url: "http://xxx",
dataType: "json",
success: function (data) {
console.log(1);
console.log(data);
},
error: function (e){
console.log(0);
console.log(e);
}
});
请求是上面这样的,接口用postman用浏览器请求都能看到数据的返回,ajax请求,回调一直走error,看来一下后台返回的数据,发现后台返回的数据并不是我要的json格式(dataType: "json"),所以告诉后台处理就行了