Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
456 B
1
Indexable
Never

<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>