This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

Fetch a JSON file with XMLHttpRequest

const xmlhttp = new XMLHttpRequest();
xmlhttp.onload = function() {
  const myObj = JSON.parse(this.responseText);

// display the value of myObj.name
  document.getElementById("demo").innerHTML = myObj.name;
};

// define XMLHttpRequest Object
xmlhttp.open("GET", "json_demo.txt");
xmlhttp.send();