JavaScript:一次同时多次发布到页面

时间:2019-11-13 15:02:50

标签: javascript jquery

我尝试在同一时间循环几次将POST发送到站点。 但是现在发生的是,它等待直到第一个完成,然后为下一个allsounds进行POST,然后创建Delay。

代码:

var allsounds = ["sound.wav","adom.wav","alarm.wav","tiny.wav","calm.wav","tiny4.wav","tiny5.wav","tiny4.wav",""];

  for (var i = 0; i < allsounds.length; i++) {
      $.post("alerts.php", {zone: zone, list: allsounds[i]});

      $.post("alerts1.php", {zone: zone, list: allsounds[i]});

      $.post("alerts2.php", {zone: zone, list: allsounds[i]});

}

0 个答案:

没有答案