JSFiddle - React, Tailwind, and code Playground
JavaScript
jQuery(function () {
var data = {
json: JSON.stringify({
text: 'Echo JSON'
}),
delay: 1
};
var jqDeferred = $.ajax({
url: '/echo/json/',
dataType: 'json',
data: data,
type: 'POST'
});
jqDeferred.then(function (response, statusText, xhrObj) {
console.log("Success", arguments);
}, function (xhrObj, textStatus, err) {
console.log("Failure", arguments);
});
Promise.cast(jqDeferred).then(function (response) {
console.log("Cast Success", arguments);
}, function (xhrObj) {
console.log("Cast Failure", arguments);
});
});