help with validate remote

help with validate remote

Hi,

I tried to use validate plugin's remote parameter to check for email duplicate, but it always output the message no matter what I do.

This is my html code
  1. <input class="required email" name="email" id="email"><br/>
my ajax

  1. $("#signupForm").validate
  2.                 ({
  3.                     rules:
  4.                     {
  5.                         email:
  6.                         {
  7.                             remote:
  8.                             {
  9.                                 url: "<?php echo base_url();?>index.php/register/emailchecker",   
  10.                                 type: "post"
  11.                             }                    
  12.                     },
  13.                     messages:
  14.                     {
  15.                         email:
  16.                         {
  17.                             remote: "Email already exists"
  18.                         }
  19.                     }   
  20.                 });


and here is my php code
  1.     function emailchecker()
  2.     {
  3.         $email = strtolower($this->input->post('email'));
  4.         $q = $this->MClients->getemail();
  5.        
  6.         foreach ($q as $key=>$list)
  7.         {
  8.             if ($email == strtolower($list['Email']))
  9.             {
  10.                 $valid = false;
  11.             }
  12.             else
  13.             {
  14.                 $valid = true;   
  15.             }
  16.         }
  17.         echo $valid;
  18.     }

Where did I do wrong?

Thanks