What does Asynchronous means in Ajax?

What does Asynchronous means in Ajax? and also how does Ajax know when to pull data without server polling?

Answers:

Answer

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.

Answer

Just about what it means in any other context. When you make an ajax call, it doesn't block until it returns.

Answer

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

Answer

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.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.