I am trying to learn more in JavaScript and I have this HTML that has a script embedded in it
<!DOCTYPE html>
<html>
<head>
  <title>Read data from External JSON file Using JavaScript</title>
</head>
<body>
  <h3>
    Data extracted from External JSON file using JavaScript.
  </h3>
  <div id='showData'></div>
</body>
<script>
  // Create XMLHttpRequest object.
  var oXHR = new XMLHttpRequest();
  // Initiate request.
  oXHR.onreadystatechange = reportStatus;
  oXHR.open("GET", "https://www.encodedna.com/library/sample.json", true); // get json file.
  oXHR.send();
  function reportStatus() {
    if (oXHR.readyState == 4) { // Check if request is complete.
      document.getElementById('showData').innerHTML = this.responseText;
    }
  }
</script>
</html>
I am using XAMPP and I have saved this in index.html
I expected to get the JSON response in the innerHTML of the DIV which id is showData but I only got the h3 innerText
