Untitled

 avatar
unknown
plain_text
2 years ago
588 B
5
Indexable
<html>
<body>
Votre nom:
<input type="text" id="txt1">
<button type="button" onclick="loadDoc()">Envoyer</button>
<p>: <div id="div1"></div></p> 
<script> 
function loadDoc() {
var str= document.getElementById("txt1").value;
 var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { 
if (this.readyState == 4 && this.status == 200) 
{ document.getElementById("div1").innerHTML =  this.responseText;} }; 
xhr.open("POST", "page2.php",true); 
$s="nom="+str;
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
xhr.send($s); } 
</script> 
</body>
</html>
Editor is loading...