var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { res = this.responseText; document.write('response is '+res); } }; data = "variable1=variable1value&variable2=variable2value"; xmlhttp.open("POST", "script.php", true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send(data);