1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| function fonction (){
xhr=getXMLHTTP();
var texte = document.getElementById("content").value;
xhr.open("POST", "traitement.php", true);
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
eval(xhr.responseText);
}
}
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
var data = "content="+texte;
xhr.send(data);
}
<form>
<input type="text" id="content">
<input type="button" value="enregistrer" onclick="fonction()" >
</form> |
Partager