I'm validating user email by ajax and php but here ajax always showing email already exit;
AJAX/Javascript Code:
$.ajax({
type: "POST",
url: "classes/aeAjaxFunction.php",
data: "do=sem&ci=" + ci11,
success: function(msg) {
if(msg ="yes") {
alert('Email already exist');
}
else {
// alert("Occured internal Error. please check network connection");
}
// $('#psid').html("<img src='images/spacer.gif'>");
//$('#email1').html(msg);
//
//$('#sid').sSelect({ddMaxHeight: '300px'});
},
error: function() {
// alert('some error has occured...');
},
start: function() {
// alert('ajax has been started...');
}
});
PHP Code:
<?php
function checkSpEmail($postAr) {
$mysqli = dbconn::get_mysqli();
$email = $postAr['ci'];
$selEmail = "SELECT fld_email FROM tbl_spouse WHERE fld_email = '$email' ";
$res = mysqli_query($mysqli, $selEmail);
$count = mysqli_num_rows($res);
if (mysqli_num_rows($res) == 1) {
echo 'yes';
exit;
}
}
?>