1

我正在使用最简单的 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";
        }
    }
?>

问题是它的警报空白值......

4

1 回答 1

3

代替return "N"and return "Y",尝试使用echo "N"and echo "Y"

于 2012-12-06T15:04:32.987 回答