Help with validation with "jquery validate"

Help with validation with "jquery validate"

Hello friends. I am denying with the validation with jquery validate to know if a user exists in the database at login. I am getting an "undefined" error, I don't know if the error will be in the json handling. I hope you can help me.
This is the working link: For example, in the database there is an email called "" and the idea is that it says on the screen that it exists if you type.


<form method="post" name="myemailform" id="myemailform" action="#" >
<label for='email'>Email Address:</label><br>
<input type="text" name="email" id="user_nickname" >
<input type="submit" name='submit' value="Post it !">

        rules: {
required: true,
email: true,
url: "chek-email.php",
type: "post"
        messages: {
                               required: "The Email is required!",

email: "Please enter a valid email address!",

remote: "The email is already in use by another user!"
        submitHandler: function (form) { // for demo
            alert('valid form submitted'); // for demo
            return false; // for demo


function isset_email($email){

global $conn;
$email = trim($email);

$query = "SELECT COUNT(*) AS num FROM  tb_usuario WHERE mailUsuario='" .mysqli_real_escape_string($conn,$email). "'";

$result = mysqli_query($conn,$query);
$row = mysqli_fetch_array($result);

return TRUE; // Si el usuario existe
return FALSE; // Si el usuario no existe