What is the difference between async:false and async:true in jquery ajax?

前端 未结 3 1216
执念已碎
执念已碎 2020-11-29 19:35

In jquery ajax there is a parameter

$.ajax({async: true, ...});

What is the difference between setting the value to true and

3条回答
  •  無奈伤痛
    2020-11-29 19:58

    Setting it to false blocks the main thread (responsible for executing JavaScript, rendering the screen, etc) and waits for the XHR to complete.

    This is almost always a terrible idea. Users don't like unresponsive UIs.

提交回复
热议问题