How {async:false} works in jQuery AJAX request?

后端 未结 2 840
感动是毒
感动是毒 2021-01-20 21:07

I know why and how to use {async:false} in jQuery AJAX request.

But what I need is how this works synchronously? What is the magic behind this?

2条回答
  •  既然无缘
    2021-01-20 21:34

    My best guess, is that when async is false, then it will wait until the readyState is set to DONE, which as defined by the W3, is:

    The data transfer has been completed or something went wrong during the transfer (e.g. infinite redirects).

    So basically when the request is completed, it will continue on.

提交回复
热议问题