0

每次我尝试从我的文件 index.php 中发布或使用 get,它通过 Ajax 函数 POST 或 GET 调用 Ajax_mysql.php,我都会不断收到内部 500 错误。服务器没有给出除此之外的任何其他错误。我已经包含了调用服务器端 php 的 javascript 函数。

function submit_login() {
    if( document.form.loggedIn.checked ) return
    request = new XMLHttpRequest()
    request.onreadystatechange = respond_login
    request.open("POST", "Ajax_mysql.php", true)
    request.send( "action=login&password=" + postEscape( document.form.pwd.value ) +
                    "&username=" + postEscape( document.form.user.value ))
    document.form.pwd.value = ""
    document.form.user.value = ""
}

PHP Ajax_mysql.php:

<?php
$password_test = "fcb";
$username_test = "ben";
$action = $_POST['action'];
$username = $_POST['username'];
$password = $_POST['password'];
//Testing against hardcoded username and password
if ($username != $username_test)
{
 //output the response
 $response = "failed"
 echo $response;
}
?>
4

1 回答 1

1
 $responce = "failed"   //miss ;
echo $response;       // typo $responce; 
于 2013-05-03T03:13:20.353 回答