title: JQuery remote validation not working
body: <p>I had a registration form which i added a JQuery validate plugin remote validation in. The purpose of the remote validation is to check if the email/and username entered by the user already exists in my database(i.e is already in use), and will return an error message if it is.The form <strong>was</strong> working before i added the remote validation. </p>
  
  <p>Now, i am unable to submit the form even when all the data i've entered is correct, and to add insult to injury, no error messages appear when i enter an email that already exists in my database.</p>
  
  <p>My JQuery code:</p>
  
  <pre><code>    $(document).ready(function(){
  &lt;!--AJAX Call to retrieve type &amp; subtype of industries--&gt;
      $("#type").load("getregtype.php");
  
      $('#type').change(function(){
          var type=$('#type').val();
          $('#subtype').load('getregsubtype.php?type='+type);
      });
  &lt;!--End of AJAX Call --&gt;
  
  &lt;!--JQuery validation of registration form--&gt;
  &lt;!--Set default message for 'equalTo' errors--&gt;
  $.extend($.validator.messages, { equalTo: "The values you entered do not match." });
      $("#regform").validate({
  
          // Specify the validation rules
          rules: {
              username: "required",
  
              password: {
                  required:true,
                  minlength:6,
              },
  
              cpassword: {
                  required: true,
                  minlength: 6,
                  equalTo: "#password"
              },  
  
              email: {
                  required: true,
                  email: true,
                  remote:"emailcheck.php"
              },
  
              cemail: {
                  required: true,
                  email: true,
                  equalTo:"#email"
  
              },
  
              type: {
                  required: true
              },
  
              subtype: {
                  required: true
              },
              name: "required"
          },
  
          // Specify the validation error messages
          messages: {
              username: "Please enter a username",
              email: {
                  required:"Please enter an email address",
                  email:"Please enter a valid email address",
                  remote:jQuery.format("{0} is already in use")
              },
              cemail: {
                  required:"Please enter an email address",
                  email:"Please reenter your email address",
  
              },
  
              password: {
                  required: "Please enter a password",
                  minlength: "Your password must be at least 6 characters long"
              },
              cpassword: {
                  required:"Please reenter your password",
                  minlength: "Your password must be at least 6 characters long"
  
              },
              name: "Please enter the name of your business"
          },
  
          submitHandler: function(form) {
              form.submit();
          }
      });
  
  
  });
  </code></pre>
  
  <p>My PHP page that is called by remote.</p>
  
  <pre><code> &lt;?php
  
  include("cxn.inc");
  
  $query=$cxn-&gt;prepare("SELECT * FROM `testdb`.`business` WHERE `Email` = :email");
  $query-&gt;bindValue(":email",$_GET['email']);
  $query-&gt;execute();
  $count=$query-&gt;rowCount();
  $mail=$_GET['email'];
  print_r($mail);
  echo"$count";
  if($count&gt;0)
  {
  
      echo json_encode('false');
  
  }
  else
  {
      echo json_encode('true');
  }
  
  ?&gt;
  </code></pre>
  
  <p><em><strong>Things tried</em></strong></p>
  
  <p>print_r($mail) and echo"$count"; both return the correct value.I've also tried </p>
  
  <pre><code>echo json_encode(true);
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>return true;
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Some more things i've tried.</p>
  
  <pre><code>echo true;
  </code></pre>
  
  <p>I've also tried to pass in the value of the email directly through the url, on the off chance that the value was not being passed to 'emailcheck.php' by doing</p>
  
  <pre><code>email: {
              required: true,
              email: true,
              remote:"emailcheck.php?email=test@test.com"
          },
  </code></pre>
  
  <p>but my form still doesn't work.</p>
  
  <p>I appreciate any insight to my problem.</p>
  
  <p>Thanks!</p>