Result Size: 300 x 150
x
 
<!DOCTYPE html>
<html>
<body>
<div id="demo">
  <h2>Об’єкт XMLHttpRequest</h2>
  <button type="button" onclick="loadDoc('ajax_info.txt', myFunction)">Change Content</button>
</div>
<script>
function loadDoc(url, xFunction) {
  const xhttp=new XMLHttpRequest();
  xhttp.onload = function() {xFunction(this);}
  xhttp.open("GET", url);
  xhttp.send();
}
function myFunction(xhttp) {
  document.getElementById("demo").innerHTML = xhttp.responseText;
}
</script>
</body>
</html>