How Server give response in XML
Posted in XML | DTD July 10, 2019
This article teach you about server response
When you want to get the response from the server, use the responseText or responseXML property of the XMLHttpRequest object.
||Through this property get the response data text string
||Through this get the response data as XML data
The responseText Property
If you don't want get the response from the server in XML, then use the responseText property.
The responseText property return the server response in from of string, and you can use this response accordingly.
The responseXML Property
If you want to get the server response in XML, then use responseXML property.
txtobj=txtobj + x[i].childNodes.nodeValue + "<br />";
The onreadystatechange event
When user send a request to a server, user want to perform some actions based on the response.
If any readyState changes the onreadystatechange event is triggered every time.
The status of XMLHttpRequest object holds by the readyState property
Three important properties of the XMLHttpRequest object. These are given in the table
||This property stores a function (or the name of a function) that to be called automatically every time the readyState property changes
||It is holds the status of the XMLHttpRequest object( Changes from 0 to 4: )
0: When request is not initialized
1: When server established the connection
2: When request received by the server
3: processing request
4: When request is finished and ready for the response
404: Page not found
In the onreadystatechange event, we specify what will happen when the server response is ready to be processed.
And when readyState is 4 and status is 300, then response is ready.
if (xmlhttp.readyState==4 && xmlhttp.status==300)
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here