title: Wordpress get user by
body: <p>Hi I am trying to have live search which searches for existing emails when a user registers. Below is my jquery script</p>
  
  <pre><code>$("#wjp_register input#user_email").change(function(){
      console.log("lol");
      var email=$("#wjp_register input#user_email").val();
        $.ajax({
              type:"post",
              dataType : 'JSON',
              url:"/wordpress/wp-content/themes/tsf/wpjobboard/job-board/check.php",
              data:"email-address="+email,
                  success:function(result){
                  if(result==0){
                      console.log(result);
                      $(".error").html(" Username available");
                  }
                  else{
                      console.log(result);
                      $(".error").html("Username already taken");
                      proceed = false;
                  }
              }
           });
  
  });
  </code></pre>
  
  <p>When i check the response in the developer console, the email is echoed successfully but the wordpress get_user_by doesnt seem to work.</p>
  
  <p>My php script</p>
  
  <pre><code>&lt;?php
  $mm = $_POST['email-address'];
  
  if ( isset( $_POST['email-address'] ) &amp;&amp; ! empty( $_POST['email-address'] ) ) {
  
    //sanitize the data
    $email_addr = trim( strip_tags( stripslashes( $_POST['email-address'] ) ) );
    echo $email_addr;//This is printed successfullt
    echo "&lt;br&gt;";
  
    //This below part doesnt work :(
      if( false == get_user_by( 'email', $email_addr ) ) {
          echo "Doesnt exist";
      } else {
          echo "exists";
      }
  
  }
  ?&gt;
  </code></pre>