<html>
<body>
<h1>The XMLHttpRequest Object</h1>
<button type="button" onclick="loadDoc()">Request data</button>
<p id="demo"></p>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("POST.html", "demo_post2.html", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("fname=Henry&lname=Ford");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/xml/tryit.asp?filename=tryajax_post2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:56:15 GMT -->
</html>