In this tutorial you will learn about the AJAX Response and its application with practical example.
After interpreting or processing the request server returns the response, to get the handle the response from the server, use the responseText or responseXML property of the XMLHttpRequest object.
Table Of Contents−
Property | Description |
---|---|
responseText | The responseText property returns the response as a string |
responseXML | The responseXML property returns an XML document object, which can be examined and parsed using W3C DOM node tree methods and properties. |
1 2 3 |
<script language="javascript"> document.getElementById("result_div").innerHTML=xmlhttp.responseText; </script> |
1 2 3 4 5 |
<script language="javascript"> var xmlDoc=xmlHttp.responseXML; document.getElementById("result_div").innerHTML= xmlDoc.getElementsByTagName("compname")[0].childNodes[0].nodeValue; </script> |