can a synchronous (blocking) ajax call block the browser's UI?

前端 未结 1 1280
时光说笑
时光说笑 2020-12-20 07:42

This question is jQuery oriented, but not necessarily exclusively.

The short question:

Can synchronous ajax call block a normal butt

相关标签:
1条回答
  • 2020-12-20 07:56

    Yes it will. While a synchronous request is outstanding, the browser waits for it to return. The probability of that happening is 100%, but if your request returns fast enough, it might not be that noticeable. Thing is, you can't count on a request returning quickly.

    That's the point of ajax calls. The first a mean asynchronous, which means, "doesn't block".

    Since ajax calls are asynchronous, your code can be anywhere when the request returns, which means you need a way to handle the response when the request does return. That is why you use callbacks to handle the response.

    Why don't you try it?

    0 讨论(0)
提交回复
热议问题