Multi-threaded ajax call for PHP

     

I am trying to make a web app that will figure out if one or many e-commerce items are out of stock from their url(s) entered by user. These urls can be seperated by commas. Currently I make ajax calls to my one of my PHP scripts for each url after spliting them by comma in a javascript loop. Below is the code for that:


function sendRequest(urls) {
if (urls.length == 0) {   return;   } else {   var A = urls.split('');   for (var i = 0; i < A.length; i++) {   var xmlhttp = new XMLHttpRequest();   xmlhttp.onreadystatechange = function () {   if (this.readyState == 4 && this.status == 200) {   var result_set = JSON.parse(this.responseText);   if (result_set.flag == 1) {   insertRow('stock-table'