JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://gist.github.com/gnarf/1039247/raw/61492dae1df5e90f3f5b132876cabfc12a6f49d2/jQuery.ajaxQueue.min.js"></script>
<button>Send</button><br>
<div></div>
JavaScript
function get() {
var list = ['obj1', 'obj2', 'obj3', 'obj4', 'obj5'],
requests = [];
for(i = 0; i < list.length; i++) {
requests.push($.ajaxQueue({
type: "POST",
url: "/echo/html/",
data: {html: list[i]},
success: function(data) {
$("div").append("Call " + data + "<br>");
}
}));
}
return requests;
}
$(document).on("click", "button", function(){
$.when.apply(null, get()).then(function(){
$.each(arguments, function(key, val){
$("div").append("Status: " + val[2].status + ", responseText: " + val[2].responseText + "<br>");
});
});
});