What is the difference between a synchronous and an asynchronous request? (async=true/false)

后端 未结 1 1029
梦如初夏
梦如初夏 2020-12-21 11:25

What is the difference between async=false and async=true, when I am using open method of XMLHttpRequest?



        
相关标签:
1条回答
  • 2020-12-21 12:03

    Mozilla Developer: Synchronous and Asynchronous Requests

    XMLHttpRequest supports both synchronous and asynchronous communications. In general, however, asynchronous requests should be preferred to synchronous requests for performance reasons.

    In short, synchronous requests block the execution of code and can leak memory and events. This can cause serious issues. The only viable reason to use synchronous requests is to more easily facilitate downloads within Web Workers.

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