Javascript 使用ajax时出现PHP内部服务器错误

Javascript 使用ajax时出现PHP内部服务器错误,javascript,php,ajax,Javascript,Php,Ajax,当我在localhost上工作时,我所有的9个页面都在毫无错误地发出ajax请求。但是当我把网站上传到服务器上时,除了登录页面外,所有页面中的ajax都可以正常工作!当我尝试登录时,它会告诉我错误 GET http://www.example.com/ajax/login.php?email=admin@me.com&password=1291995 500 (Internal Server Error) 这是我在我的网站上使用的登录代码 function login(){ v

当我在localhost上工作时,我所有的9个页面都在毫无错误地发出ajax请求。但是当我把网站上传到服务器上时,除了登录页面外,所有页面中的ajax都可以正常工作!当我尝试登录时,它会告诉我错误

GET http://www.example.com/ajax/login.php?email=admin@me.com&password=1291995 500 (Internal Server Error)
这是我在我的网站上使用的登录代码

function login(){
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            if(xmlhttp.responseText=="")
                {document.getElementById("errorInLogin").style.display="block";
                console.log(xmlhttp.responseText);}
            else{
                window.open("profile.php?id="+xmlhttp.responseText,"_self");
            }
        }
    }
    xmlhttp.open("GET", "ajax/login.php?email=" + document.getElementById("email").value + "&password=" + document.getElementById("password").value, true);
    xmlhttp.send();
}
这是我的登录php文件代码

require_once ('../functions/DataBaseConnection.php');  
if (mysqli_real_escape_string($con,empty($_GET['email']))||empty(mysqli_real_escape_string($con,$_GET['password'])))
    {echo "";die("");}
else
{
    $email=mysqli_real_escape_string($con,$_GET['email']);
    $p=mysqli_real_escape_string($con,$_GET['password']); 

    $sql = "SELECT `userid`, `email`,`password` FROM `user` WHERE email='$email'";
    $userQuery=$con->query($sql) or die(mysqli_($con));
    if($user=mysqli_fetch_array($userQuery))
    {
        $uid=$user['userid'];
        $pass=$user['password'];
        if(md5($p)==$pass) 
        {
            session_start();
            $_SESSION['userid'] = $uid;
            echo $uid;
            die("");
        }   
        else 
        {
           echo "";die("");}
    }
    else 
        {echo "";die("");}
}
我的代码中是否有任何东西会导致此错误?
奇怪的是,Ajax在我所有的文件中都能工作,除了这个文件,有什么问题吗?如何修复它?

检查错误日志,答案应该在那里。浏览器中显示的相同错误在错误日志文件中。没有关于错误的描述,所以我可以用谷歌搜索它。PHP页面自己工作吗?你说的“自己”是什么意思?你现在已经排除了AJAX。您必须跟踪PHP中的错误并修复它。检查错误日志,答案应该在那里。浏览器中显示的相同错误在错误日志文件中。没有关于错误的描述,所以我可以用谷歌搜索它。PHP页面自己工作吗?你说的“自己”是什么意思?你现在已经排除了AJAX。您必须跟踪PHP中的错误并修复它。