What are the steps for handling concurrent requests in AJAX?

Questions by RajivPrasad   answers by RajivPrasad

Showing Answers 1 - 12 of 12 Answers

Arvind

  • Jul 9th, 2007
 

I believe it can be done by creating the XMLHTTPRequest object from within an inner function, instead of creating a seperate function for making a new XmlHttprequest object withing the same page...

Hope this helps!!

Regards,

  Was this answer useful?  Yes

jollykid

  • Mar 17th, 2008
 

In order to handle the request concurrently, its always better to achive through writing the separate function. For e.g.

xmlHTTPObj.Onreadystatechange = function1();

The above line of code will help us to do asynchronous processing. So function1() will be called when the XMLHTTP request object goes to on ready state change.

Dont forget to set the parameter "TRUE" in the Open method of xmlHTTPObj. The followign e.g. shows this.

xmlHTTPObj.open("GET","http://"+location.host + "XMLHTTPExample1/Webform1.aspx" true)

"true" reperesents the processing carried after the send() method, without waiting for a response. "false" means that processing waits for the response before continuing.

Thanks
Venkatesh Kumar

  Was this answer useful?  Yes

AJAX - Asynchronous Java Script AND XML.
Using AJAX your Java script can directly communicate with server.

AJAX use XMLHttpRequest Object to communicate with Server..

Now It Works..

XMLHttpRequest Object have three Different Properties.

1) OnReadyStateChangePropert -  After Request to Server You need a Function to store the Response from Server.

xmlHttp.onreadystatechange = function (){

}

2) ReadyState =  Using This Propert you can Check the Response State.

ReadyState  = 0  It Means Request Initialized
ReadyState  = 1  It Means Request set up
ReadyState  = 2  It Means Request sent
ReadyState  = 3  It Means Request Progress
ReadyState  = 4  It Means Request Complete

3) ResponseText =  Data Sent By Server will get By Response Text Property.

Steps...
1) First Check The xmlHttp Request Object Which Supports your Browser

Internet explorer -- ActiveXObject
FireFox                 -- XmlHttpRequest Object

2) Then Use These Property

xmlHttp.onReadyStateChange = function () {

          if (xmlHttp.ReadyState == 4)
          {
                document.getelementByid.innerHtml('center') = xmlHttp.ResponseText;
          }

}

3)xmlHttp.open("GET","Name of Page , you are requesting",true);
4)xmlHttp.send(null);

r4zeal

  • Aug 16th, 2008
 

3) xmlHttp.open("GET","Name of Page , you are requesting",true);

Can anyone explain how can I use POST method for sending data to Servlet? I want to send an object which contains all the data directly to servlet instead of GET

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions