 <p>you need to add a var as xmlhttp; on starting to get the status result please use below code i modify it,</p> <pre><code>&lt;script&gt; //Ajax to send request.. function sendPayment() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { alert(xmlhttp.readyState);// this always returns = 1 alert(xmlhttp.responseText) ; //this is always empty. if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { if (xmlhttp.responseText=='1') { alert('success'); } } } xmlhttp.open("POST","payments/callSSL.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(Id=100); return false; } &lt;/script&gt; </code></pre>