title: Not able to get successful login in web page using ajax
body: <p>here is the code
  I am not able to get the message as successful login despite debugging in console whereas directly entering the php link with username &amp; password in browser directly is working perfectly</p>
  
  <p>The output I'm getting is " INcorrect Login information. Please Try Again".</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Login&lt;/title&gt;
  &lt;script src="/_js/jquery-2.1.3.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function() {
  $('#login').submit(function() {
  var formData = $(this).serialize();
  $.post('login.php',formData,processData).error('ouch');
  function processData(data) {
        console.log(data==='pass');
      if (data==='pass') {
         $('.main').html('&lt;p&gt;You have successfully logged in!&lt;/p&gt;');
      } else {
         if ($('#fail').length === 0) {
           $('#formwrapper').prepend('&lt;p id="fail"&gt;Incorrect login information. Please try again&lt;/p&gt;');
        }
      }
    } // end processData
  return false;
    }); // end submit
  
  }); // end ready
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="wrapper"&gt;
  &lt;div class="header"&gt;
      &lt;p class="logo"&gt;Demo LOGIn&lt;/p&gt;
  &lt;/div&gt;
    &lt;div id="content"&gt;
      &lt;div class="main"&gt;
          &lt;h1&gt;Login&lt;/h1&gt;
          &lt;div id="formwrapper"&gt;
          &lt;form method="POST" action="../_php/login.php" id="login"&gt;
  &lt;p&gt;
      &lt;label for="Username"&gt;Username:&lt;/label&gt;
      &lt;input type="text" name="Username" id="Username"&gt;
  &lt;/p&gt;
  &lt;p&gt;
      &lt;label for="Password"&gt;Password: &lt;/label&gt;
      &lt;input type="text" name="Password" id="Password"&gt;
  &lt;/p&gt;
  &lt;p&gt;
      &lt;input type="submit" name="button" id="button" value="Submit" &gt;
   &lt;/p&gt;
   &lt;/form&gt;
   &lt;/div&gt;
      &lt;/div&gt;
   &lt;/div&gt;
  
   &lt;/div&gt;
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>and here is php file 
        
  
  <pre><code> $Username = mysqli_real_escape_string($con,$_POST['Password']);
   $Password = mysqli_real_escape_string($con,$_POST['Username']);
  
  $result = mysqli_query($con,"SELECT Password from Use_Pass WHERE     Username='$Username'");
   $count=mysqli_num_rows($result);
   $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
   // If result matched $myusername and $mypassword, table row must be 1 row
  if($count==1)
  {
  echo 'pass';
  }
  else {
  echo 'fail';
  }
  
  
  mysqli_close($con); 
  ?&gt;  
  </code></pre>