What does Asynchronous means in Ajax? and also how does Ajax know when to pull data without server polling?
4 Answers
Asynchronous means that the script will send a request to the server, and continue it's execution without waiting for the reply. As soon as reply is received a browser event is fired, which in turn allows the script to execute associated actions.
Ajax knows when to pull data from server, because you tell it when to do it.

- 61,444
- 9
- 118
- 120
-
1"Ajax knows when to pull data from server, because you tell it when to do it." How do i do that? – JCX Aug 03 '10 at 05:25
-
6You, as a creator of the script, tell it to send a request to server when certain conditions are met (for example: 'when DOM is ready', 'when user presses this button', 'when value in textfield changes', 'every 5s', etc). – Mchl Aug 03 '10 at 05:34
-
3Err... on the internet? Search for 'AJAX tutorials' http://www.w3schools.com/ajax/ajax_intro.asp – Mchl Aug 03 '10 at 05:57
Just about what it means in any other context. When you make an ajax call, it doesn't block until it returns.

- 39,895
- 28
- 133
- 186
Browsers do not give access to threading model, so we have just a single thread to handle the User Interface. So, all the modifications in the application is in the same thread.
Fortunately, the browsers exposes several async API's, like XHR(XMLHttpRequest), also known as AJAX. When you register a event handler for some object, the action for this object will be executed in another thread and the browser will trigger the event in the main thread.
So async mean that the browser won't wait for when the main thread is free to perform the action

- 2,371
- 19
- 28
Asynchronous (in Ajax) processes incoming requests in a constant event stack and sends small requests one after the other without waiting for responses. In other words, asynchronous ajax call allow the next line of code to execute, whereas synchronous call stop JavaScript execution until the response from server.

- 69
- 3