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


Smartphone icons created by Freepik - Flaticon

The XMLHttpRequest Object

// button click event to load the external file
onclick="loadDoc()"

function loadDoc() {

// create XMLHttpRequest()
  const xhttp = new XMLHttpRequest();
  xhttp.onload = function() {

// read the file and display its contents
    document.getElementById("demo").innerHTML =
    this.responseText;
  };

// defines the XMLHttpRequestObject
  xhttp.open("GET", "ajax_info.txt");
  xhttp.send();
}