function checkAvailability() {
$("#loaderIcon").show();
jQuery.ajax({
url: "check_availability.php",
data:'email='+$("#email").val(),
type: "POST",
success:function(data){
$("#user-availability-status").html(data);
$("#loaderIcon").hide();
},
error:function (){}
});
}
代码工作正常....... 但是如果电子邮件已经存在于数据库中,那么表单不应该提交 ...我刚接触java脚本该怎么办?
<?php
include('conection.php');
if(!empty($_POST["email"])) {
$result = mysql_query("SELECT * FROM user WHERE email='" . $_POST["email"]
. "'");
$row = mysql_fetch_row($result);
$user_count = $row[0];
if($user_count>0) {
echo "<span class='status-not-available'> Email Already
Registered</span>";
}else{
echo "<span class='status-available'> Email Available.</span>";
}
}
?>