Open
Description
jqXhr.done() and jqXhr.always() methods return a jqXhr object while jqXhr.then() returns a promise, which is not that obvious at all.
For example, this code works:
var jqXhr1 = $.ajax({
url: "data.json",
method: "GET",
dataType: "json"
}).always(function () {
console.log("Always 1");
});
jqXhr1.abort();
But this doesn't:
var jqXhr2 = $.ajax({
url: "data.json",
method: "GET",
dataType: "json"
}).then(function () {
console.log("Then 2");
});
jqXhr2.abort(); // fails, cause it's a promise