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 for loadDoc()
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 to POST and to use Content-type encoding
  xhttp.open("POST", "demo_post2.php");
  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xhttp.send("fname=Henry&lname=Ford");
}