I am using simplest code of Jquery to check if the request is made to server to check certain table column and return true or false accordingly….
$.ajax({
type: "POST",
url: "check_ajax_availablity.php",
data: "user_name=" + user_name,
success: function (server_response) {
alert(server_response);
}
});
My PHP script is …
<?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";
}
}
?>
Issue is its alerting blank value…
Instead of
return "N"andreturn "Y", try usingecho "N"andecho "Y".