Server response
To get the response from the server, use the responseText or responseXML property of the XMLHttpRequest object.
Attributes | description |
---|---|
responseText | Get the response data in string form. |
responseXML | Obtain the response data in XML format. |
responseText property
If the response from the server is not XML, use the responseText property.
The responseText property returns the response as a string, so you can use it like this:
Instance
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
responseXML attribute
If the response from the server is XML and needs to be parsed as an XML object, use the responseXML attribute