<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.html", url);
xhttp.send();
}
function myFunction(xhttp) {
document.getElementById("demo").innerHTML = xhttp.responseText;
}
</script>
</body>
<!-- Mirrored from www.mdssup.ma/js/tryit.asp?filename=tryjs_ajax_callback by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 14:47:00 GMT -->
</html>