Open XMLHttpRequest Method

What is the difference between Sync and Async in the open method (method, url, async) in AJAX.

+3
source share
5 answers

The difference is that Sync does not exist. Ignore it. Five years ago, I wrote a whole synchronous widget library, and I became a better programmer when I rewrote it :-) I mention jQuery in this sentence, but I prefer YUI. Whatever you do, watch the video on Yahoo Theater : basic and advanced Javascript, the problem with Dom, that's it. They are swinging.

+4
source

true async, , javascript ( , HTTP- ).

false, , HTTP- .

+4

, a.k.a.; Async , a.k.a. .

+1
  • open() async=false send().
  • open() async=true send() .

async false , javascript , , , .

+1

sync , javascript ,

async means the server call will be executed in parallel thread and your js will continue to execute.

You should never use sync - a bad user interface for humans

Added: And you most likely should not use XMLHttpRequest directly - there are subtle differences between browsers. It is much better to use a library like jQuery, yui, mootools, etc.

0
source

Source: https://habr.com/ru/post/1747260/


All Articles