You can use ajax to access the server side of the script to check the availability of email, and then display an error / error message depending on the response received from the server.
As, for example, in the case of blurring the email field (when it loses focus), you can turn off an event that has a server-side call using ajax, and then depending on the answer you can hide / show which contains an error message.
Your email field might look like this:
<input type="text" name="email" class="email" />
The jQuery code looks something like this:
$("input.email").blur( function() {
$.ajax({
url: 'ajax/getData.php?email=' + $(this).val(),
success: function(data) {
}
});
});
source
share