title: Ajax Validate username and password
body: <p>I need help! I have this code that work very good to validate username in mysql database using Ajax, php and Javascript but when I try to add for validate the password too not work and I have been test all possible ways in my mind!</p>
  
  <p>-- Code in html page to validate username</p>
  
  <pre><code>function admin_search(){
      $("#checkuser").click(function(){
          var user_name = $('#admin_user').val();
  
          if(user_name == ""){
              $("#disp").html("");
          }
          else{
              $.ajax({
                  type: "POST",
                      url: "checklogin_admin.php",
                      data: "user_name="+ user_name ,
                      success: function(html){
                          $("#disp").html(html);
                      }
              })
          return false;
          }
      })
  }
  </code></pre>
  
  <p>-- Code in checklogin_admin.php</p>
  
  <pre><code>if(isset($_POST['user_name'])) {
  
              $user_admin = mysql_real_escape_string($_POST['user_name']);
  
              $query = mysql_query("SELECT * FROM $tbl_name WHERE user='$user_admin'");
  
              $row = mysql_num_rows($query);
  
              if($row == 0) {
                  echo "&lt;span style='color:red;'&gt;NOT EXIST&lt;/span&gt;";
                      } else
                      {
                          echo "&lt;span style='color:green;' id='exist'&gt;EXIST&lt;/span&gt;";
                              }
  </code></pre>
  
  <hr>
  
  <p>Im tying to add for validate the password too with this:</p>
  
  <pre><code>function admin_search(){
      $("#checkuser").click(function(){
          var user_name = $('#admin_user').val();
          var user_pass = $('#admin_pass').val();
  
          if((user_name == "") &amp; (user_pass == "")){
              $("#disp").html("");
          }
          else{
              $.ajax({
                  type: "POST",
                      url: "checklogin_admin.php",
                      data: "user_name="+ user_name
                            "user_pass="+ user_pass,
                      success: function(html){
                          $("#disp").html(html);
                      }
              })
          return false;
          }
      })
  }
  </code></pre>
  
  <p>But, nothing works!</p>