When I call the following jquery.ajax it always returns a fail. When I look further into the response it shows an ok status and 200 response.
Why is it throwing a "fail" event?
$.ajax({
url: "myurl",
type: "POST",
contentType: "application/json; charset=utf-8",
data: mydata,
dataType: "json"
}).done(function (data) {
alert("success" + data.slice(0, 100)); })
.fail(function (v) {
console.log(v); })
.always(function (v) {
alert("complete"+v);
});
The data is reaching my backend url correctly.
我确保服务器以一些有效的json数据响应并且一切正常。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.