1<script>
2function loadDoc() {
3 var xhttp = new XMLHttpRequest();
4
5 //looking for a change or state , like a request or get.
6 xhttp.onreadystatechange = function() {
7
8 //if equal to 4 means that its ready.
9 // if equal to 200 indicates that the request has succeeded.
10 if (this.readyState == 4 && this.status == 200) {
11 document.getElementById("demo").innerHTML = this.responseText;
12 }
13 };
14
15 //GET method for gettin the data // the file you are requesting
16 xhttp.open("GET", "TheFileYouWant.html", true);
17
18 //sending the request
19 xhttp.send();
20}