A common question in JQuery interview questions for experienced, don't miss this one.   As of Jquery 1.5, Jquery ajax() returns jqXHR object, which implements the Promise interface, the promise includes a callback method called jqXHR.fail(); Ex: let jqxhr = $.ajax("ServerPage.php")
.done(function() {
alert( "success" );
})
.fail(function( jqXHR, textStatus ) {
alert( "Request failed: " + textStatus );
});