1

Temat: XMLHttpRequest()

<!DOCTYPE html>
<html>
<body>

<button type="button" onclick="loadXMLDoc()">Change Content</button>

<a href="#" onclick="loadXMLDoc()">Change Content</button>

<p id="demo">hhhhhhhhhhhhh</p>

<script>
function loadXMLDoc() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("demo").innerHTML =
      this.responseText;
    }
  };
  xhttp.open("GET", "test.txt", true);
  xhttp.send();
}
</script>

</body>
</html>