Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h2>The XMLHttpRequest Object</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>