我使用最简单的Jquery代码来检查是否向服务器发出请求以检查某些表列并相应地返回true或false ....
$.ajax({
type: "POST",
url: "check_ajax_availablity.php",
data: "user_name=" + user_name,
success: function (server_response) {
alert(server_response);
}
});
我的PHP脚本是......
<?php
include 'admin_functions.php';
if (isset($_REQUEST)) {
$user_name = $_REQUEST['user_name'];
$condition = " `UserName` = '" . $user_name . "'";
$result = $oAdmFun->chk_records('login_admin', $condition);
if ($result == TRUE) {
return "N";
} else {
return "Y";
}
}
?>
问题是警告空白值......
答案 0 :(得分:3)
而不是return "N"
和return "Y"
尝试使用echo "N"
和echo "Y"
希望这会对你有所帮助。