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

// mouse click event loadDoc() function
onclick="loadDoc()"

// display XMLHttpRequest Object contents
function loadDoc() {
  const xhttp = new XMLHttpRequest();
  xhttp.onload = function() {
    document.getElementById("demo").innerHTML = this.responseText;
  };

// defines the XMLHttpRequest Object and inserts the variables fname and lname
  xhttp.open("GET", "demo_get2.php?fname=Henry&lname=Ford");
  xhttp.send();
}