title: trying to check live email availability using ajax
body: <pre><code>function checkAvailability() {
      $("#loaderIcon").show();
      jQuery.ajax({
          url: "check_availability.php",
          data:'email='+$("#email").val(),
          type: "POST",
          success:function(data){
              $("#user-availability-status").html(data);
              $("#loaderIcon").hide();
          },
          error:function (){}
      });
  }
  </code></pre>
  
  <p>the code is working fine.......<strong>but if email already exist in database then form should not be submitted</strong>...i m new to java script what to do ?</p>
  
  <pre><code>&lt;?php
  include('conection.php');
  
  
  if(!empty($_POST["email"])) {
    $result = mysql_query("SELECT * FROM user WHERE email='" . $_POST["email"]
          . "'");
   $row = mysql_fetch_row($result);
      $user_count = $row[0];
    if($user_count&gt;0) {
    echo "&lt;span class='status-not-available'&gt; Email Already 
      Registered&lt;/span&gt;";
    }else{
    echo "&lt;span class='status-available'&gt; Email Available.&lt;/span&gt;";
     }
    }
    ?&gt;
  </code></pre>