JSFiddle - React, Tailwind, and code Playground
JavaScript
var echoSuccess = function(data){ /* this never gets called */ }
var echoFailure = function(error){ /* this never gets called */ }
failingCondition = true;
$.ajax(
{ method:"post",
url:'/echo/json',
data: {foo:'bar'},
beforeSend: function(jqXHR){
if(failingCondition){ jqXHR.abort() }
return true
}
}
).then( echoSuccess, echoFailure )
// Uncaught TypeError: Object false has no method 'then'