JSFiddle - React, Tailwind, and code Playground
JavaScript
var url = 'https://httpbin.org/get';
var url2 = 'https://httpbin.org/FAIL';
function ajax1(url) {
return $.ajax({
url: url
});
};
function ajax2(url) {
return $.ajax({
url: url
});
};
var onSuccess = function(a1, a2) {
console.log("All requests successful!");
};
var onError = function(res) {
console.log("Request failed with responseText: " + res.responseText);
};
$.when(
ajax1(url),
ajax2(url2)).then(onSuccess, onError);