<html>
<body>
<h2>The XMLHttpRequest Object</h2>
<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("GET.html", "demo_get.html", true);
xhttp.send();
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_ajax_get by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:40:15 GMT -->
</html>