I need to check email exist in the table if already exist show alert without refreshing the page?
<input class="form-control" type="email" name="email" id="email" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" onblur="javascript:checkInput();" placeholder="Email address" >
<button type="submit" name="submit" id="submit" onClick="reg()" class="btn btn-primary btn-block"> Create Account </button>
<script>
///////////////////////////////// Email Validate Function ////////////////////////////////////////
function validateEmail($email) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
return emailReg.test( $email );
}
///////////////////////////////// Login User ////////////////////////////////////////
function reg()
{
var email = $("#email").val();
var password = $("#password").val();
if (email == null || email == "")
{
$("#loginerrormsg").html("Please enter Valid Email");
alert("Please enter Registered Email");
$("#loginerrormsg").show();
setTimeout(function(){ $("#loginerrormsg").hide();}, 3000);
}