Edit This Code:
<!DOCTYPE html>
<html>
<body>

<h2>Retrieve data from XML file</h2>

<p><b>Status:</b> <span id="A1"></span></p>
<p><b>Status text:</b> <span id="A2"></span></p>
<p><b>Response:</b> <span id="A3"></span></p>

<button onclick="loadDoc('note.xml')">Get XML data</button>

<script>
function loadDoc(url) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      document.getElementById('A1').innerHTML = xhttp.status;
      document.getElementById('A2').innerHTML = xhttp.statusText;
      document.getElementById('A3').innerHTML = xhttp.responseText;
    }
  };
  xhttp.open("GET", url, true);
  xhttp.send();
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy