JSFiddle - React, Tailwind, and code Playground
JavaScript
var data = {
json: JSON.stringify({
text: 'some text',
array: [1, 2, 'three'],
object: {
par1: 'another text',
par2: [3, 2, 'one'],
par3: {}
}
}),
delay: 3
};
var firstRequest = $.ajax({
url:'/echo/json/',
data: data,
type: 'POST'
});
var secondRequest = $.ajax({
url:'/echo/json/',
data: data,
type: 'POST'
});
$.when.apply($, [firstRequest, secondRequest]).done(function(data1, data2){
console.log(data1); // returns promise, I expect a response object
console.log(data2);
});