|
Suitability: The synchronous model is not suitable with the kind of client application that often does interactions to the server. Especially within a web application because it makes them very slow.
With asynchronous model,the client application does not consume much of the user’s time making him wait for the response. Therefore,the user feels in real-time while interacting. The sequence diagram below shows the functioning of an asynchronous model:

This diagram shows that after sending the request,the client can do something else instead of wasting his time waiting for the response and doing nothing.
XMLHttpRequest object supports the asynchronous model. Using it in web application does not make you wait for the server to response after making a request. The web application continues with other tasks rather than staying and listening to the response. Therefore,it prevents users from spending a long time waiting.
XMLHttpRequest object has the open method to set asynchronous or not,like as in following:
var strValidationServiceUrl = “userValidation?user=VisualBulder”; var bAsynchronous = true; var strHttpMethod = “GET”;
oXMLRequest.open(strHttpMethod,strValidationServiceUrl,bAsynchronous);
|