JSFiddle - React, Tailwind, and code Playground
JavaScript
function makeRequest(i) {
var ajaxTime = new Date().getTime();
$.ajax({
url: '/echo/json/',
type: 'POST',
data: {
json: JSON.stringify({
hello: 'world'
}),
delay: i
}
}).done(function () {
var total = new Date().getTime() - ajaxTime;
console.log('Elapsed time: ' + total);
});
}
$(function () {
var i;
for (i = 0; i < 5; i++) {
makeRequest(i);
}
});