PHP AJAX 没有得到任何响应


PHP AJAX getting no response

我正在使用PHP和AJAX在页面中发布帖子。下面是页面的javascript代码。

function Post(posted_by, posted_to)
    {
        document.getElementById('post_textarea').disabled='disabled';
        document.getElementById('post_button').style.display='none';
        document.getElementById('loader').style.display='inline';
        if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttpPost=new XMLHttpRequest();
        }
        else
        {// code for IE6, IE5
            xmlhttpPost=new ActiveXObject("Microsoft.XMLHTTP");
        }
        var post=document.getElementById("post_textarea").value;
        var params="type=post&posted_by=" + posted_by + "&posted_to=" + posted_to + "&post=" + post //Parameters for post method..
        xmlhttpPost.open("POST","test.php",true);
        //Send headers; data sent as if it has been posted from form
        xmlhttpPost.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttpPost.setRequestHeader("Content-length", params.length);
        xmlhttpPost.setRequestHeader("Connection", "close");
        xmlhttpPost.onreadystatechange=function()
        {   
            //I can reach here...
            if (xmlhttpPost.readyState==4 && xmlhttpPost.status==200)
            {
                //BUT I CAN'T REACH HERE.. GETTING NO RESPONSE
                document.getElementById('posts').innerHTML = xmlhttpPost.responseText + document.getElementById('posts').innerHTML;
                document.getElementById("post_textarea").value=""; //Clear textbox
                hidePostBox();
            }
        }
        xmlhttpPost.send(params); //Send POST DATA to the server.. 
    }

在PHP文件中,我回显了一行文本来测试它是否有效。

但我没有得到那行文字作为回应。完全没有回应。

我在另一个网站使用相同的javascript代码,它正在工作。这里的相同代码不起作用。

可能有什么故障??

好的。我从未使用过错误控制台。我今天第一次使用它。并发现问题是它没有获取PHP文件,因为我使用了HTACCESS URL重写并且它搞砸了它