Untitled
unknown
plain_text
3 years ago
481 B
10
Indexable
<html>
<body>
<div id="div1">
<h1> XMLHttpRequest Object</h1>
<button type="button" onclick="loadDoc()">Changer le contenu</button>
</div>
<script>
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("div1").innerHTML =
this.getAllResponseHeaders();
}
};
xhttp.open("GET", "file1.txt", true);
xhttp.send();
}
</script>
</body>
</html>Editor is loading...