I want to ask the question about JS function, now I want the function is checking username Here it's my JS code :
jQuery.validator.addMethod("noSpace", function(value, element) {
return value.indexOf(" ") < 0 && value != "";
});
$().ready(function()
{
$("#signupForm").validate(
{
rules:
{
full_name: "required",
username: {
required: true,
minlength: 2,
noSpace: true,
},
password: {
required: true,
minlength: 5
},
email: {
required: true,
email: true
},
},
messages:
{
full_name: "Please enter your full name",
username:
{
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters",
noSpace: "No space allowed",
},
password:
{
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
email: "Please enter a valid email address"
}
});
});
So how can I add the function to checking available username and show it in below the input text username (if available or not), If available user can continue the submit the form. If not, user can't continue submit the form.
To check the username I using PHP language with Mysql Database.
Any idea ?