This site is mobile accessible. Press the "Tap Here" button to use a different font-size.
Smartphone icons created by Freepik - Flaticon
Property | Description |
---|---|
responseText | get the response data as a string |
responseXML | get the response data as XML data |
The
property returns the server response as a JavaScript string, and you can use it accordingly:document.getElementById("demo").innerHTML = xhttp.responseText;
Request the file cd_catalog.xml and parse the response:
const xmlDoc = xhttp.responseXML; const x = xmlDoc.getElementsByTagName("ARTIST"); let txt = ""; for (let i = 0; i < x.length; i++) { txt += x[i].childNodes[0].nodeValue + "<br>"; } document.getElementById("demo").innerHTML = txt; xhttp.open("GET", "cd_catalog.xml"); xhttp.send();
Method | Description |
---|---|
getResponseHeader() | Returns specific header information from the server resource |
getAllResponseHeaders() | Returns all the header information from the server resource |
The
method returns all header information from the server response.const xhttp = new XMLHttpRequest(); xhttp.onload = function() { document.getElementById("demo").innerHTML = this.getAllResponseHeaders(); } xhttp.open("GET", "ajax_info.txt"); xhttp.send();
The
method returns specific header information from the server response.const xhttp = new XMLHttpRequest(); xhttp.onload = function() { document.getElementById("demo").innerHTML = this.getResponseHeader("Last-Modified"); } xhttp.open("GET", "ajax_info.txt"); xhttp.send();
Eventually the navigation links, above, will be replaced by these (previous) and (next) buttons below.
JavaScript icons used in the buttons provided by ICONS8.COM. Smartphone icons created by Freepik - Flaticon