function ajax() { var xhr=null; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } //on appelle le fichier reponse.txt xhr.open("POST", "reponse.php", true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); nom1=document.getElementById('nom').value; xhr.send("nom1="+nom1); alert(xhr.responseText); }