Untitled

 avatar
unknown
plain_text
2 years ago
456 B
4
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.responseText; } }; 
xhttp.open("GET", "file1.txt", true); 
xhttp.send(); } 
</script> 
</body> 
</html>
Editor is loading...