1
我突然開始得到以下:
TypeError: $.ajax(...).done(...).fail(...).complete is not a function
我的代碼:
this.sendRequest = function (type, extension, data, successCallback, successMsg, failMsg, failCallback) {
var self = this;
var options = {
url: self.baseUrl + self.apiEndpoint + extension,
type: type,
dataType: 'json',
xhrFields: {
withCredentials: true
}
};
if (data != null) {
options.data = data;
}
return $.ajax(options)
.done(function (response) {
// do stuff
})
.fail(function (response) {
// do stuff
}).complete(function (response) {
// do stuff
});
};
這是怎麼發生的?我更新了jQuery - 是否有一些此語法失效?
是; 'complete'已被棄用,因爲jQuery 3.0 – Hamms
@Hamms我應該用什麼來代替? – user666
'always'; [docs](http://api.jquery.com/jquery.ajax/)也有這個信息 – Hamms