Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>The XMLHttpRequest Object</h2> <p id="demo"></p> <script> const xhttp = new XMLHttpRequest(); xhttp.onload = function() { const xmlDoc = this.responseXML; const x = xmlDoc.getElementsByTagName("ARTIST"); let txt = ""; for (let i = 0; i < x.length; i++) { txt = txt + x[i].childNodes[0].nodeValue + "<br>"; } document.getElementById("demo").innerHTML = txt; } xhttp.open("GET", "cd_catalog.xml"); xhttp.send(); </script> </body> </html>