How to handle multiple or concurrent requests in Ajax?

Asked By 0 points N/A Posted on -
qa-featured

How to handle multiple or concurrent requests in Ajax? Please explain.

 

SHARE
Answered By 5 points N/A #113897

How to handle multiple or concurrent requests in Ajax?

qa-featured

For multiple or concurrent requests, create a separate XmlHttpRequest objects for each request.

For example,

If you want to create a request to get data from an SQL tableA, Use the below mention code … 

xmlHttpObject1.Onreadystatechange = functionfromTableA();

and to get data from another table (say tableB) at the same time, use

xmlHttpObject2.Onreadystatechange = functionfromTableB();

You have to open the XmlHttpObject & parameters passed too, like as mentioned below

xmlHTTPObject1.open("GET","http://"localhost// " + "Website1/Default1.aspx" true);

The parameter “true” used in the last in the above mentioned code. This means the process will carry on without waiting for the response from the webserver. If it is “false” It will wait for the response from the web server.

Related Questions