title: Jquery ajax request showing a old response
body: <p>Hi I have a jQuery ajax request for a login system. At first, it worked very well. But after a few try, it just started to show negative response. I checked firebug and it says that the response is, in my case "Connected". But the ajax response just shows "Not_connected". I don't know what to do :(. Please help me.</p>
  
  <p>This is my jquery code :</p>
  
  <pre><code>var data_str = "username="+usrn+"&amp;password="+pwd;
  $.ajax({
      type: "POST",
      url: "index.php?rnd=" + Math.random(),
      data : data_str,
      complete : function(xhr,data){
          if(data == 'connected'){window.location.href = 'admin.php';}
              else if(data = 'not_connected'){ error_gen.html('Invalid username or password'); }
              alert(data);
          }
  });
  </code></pre>
  
  <p>AS for the PHP code :</p>
  
  <pre><code>$log_result = $u_obj-&gt;login_user();
  if($log_result == true)/*user is connected*/
  {
      echo 'connected';
      exit;/*stoping the script after sending the result*/
  }
      elseif($log_result == false)/*error while logging in*/
      {
          echo 'not_connected';
          exit;/*stoping the script after sending the result*/
      }
  </code></pre>