title: AJAX love username verification from database
body: <p>No response from this script...cant find any errror by myself..please correct if i am wrong at any point</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function(){
  $("#name").keyup(function() {
  var name = $('#name').val();
    if(name=="")
      {
        $("#disp").html("");
      }
    else
      {
        $.ajax({
         type: "POST",
         url: "user_check.php",
         data: "name="+ name ,
         success: function(html){
         $("#disp").html(html);
      }
  });
  return false;
  }
  });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>here is the url php content for checking the database..it works without ajax</p>
  
  <pre><code>&lt;?php
  include('db.php');
  if(isset($_POST['name']))
  {
  $name=mysqli_real_escape_string($_POST['name']);
  $query=mysqli_query("select * from user where username='$name'");
  $row=mysqli_num_rows($query);
  if($row==0)
  {
  echo "&lt;span style='color:green;'&gt;Available&lt;/span&gt;";
  }
  else
  {
  echo "&lt;span style='color:red;'&gt;Already exist&lt;/span&gt;";
  }
  }
  ?&gt;
  </code></pre>