JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Open your console.</h1>
JavaScript
$.ajaxTransport("cat", function( options, originalOptions, jqXHR ) {
console.log("Executing ajaxTransport");
if(true) {
return {
send: function( headers, completeCallback ) {
completeCallback(404, "error", {});
},
abort: function() {
/* abort code */
}
};
}
});
$.ajax({ url: "?jqTrans=" + (+(new Date())), dataType: "cat" })
.done(function() {
console.log("ERROR: Should haved failed but didn't!");
})
.fail(function() {
console.log("SUCCESS: Should have failed and did.");
});