This repository has been archived on 2020-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
ibz/web/3_sem/html/ajax.html

25 lines
487 B
HTML

<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Change Content</button>
</div>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = this.responseText;
}
};
xhttp.open("GET", "schottland.txt", true);
xhttp.send();
}
</script>
</body>
</html>