Home  >  Q&A  >  body text

javascript - AJAX request question

Native JS, using AJAX, taking GET as an example
Previously, the network was interrupted after 1 second of AJAX submission (the request content was not returned within 1 second due to network and program reaction reasons), but after the network was restored (with a short timeout A few seconds later) but the request content can continue to be received.
If there is no network currently, and then click Submit AJAX to restore the network one second later, in this case, after the network is restored, will AJAX continue to send requests?
?

習慣沉默習慣沉默2663 days ago834

reply all(1)I'll reply

  • 阿神

    阿神2017-07-05 11:07:09

    Not necessarily.

    After AJAX sends a request, it cannot determine whether the network has been disconnected (now HTML5 has added the network status API), so ajax will continue to be sent until timeout. If you reply to the network before timeout, ajax will also be sent.

    reply
    0
  • Cancelreply