title: Problems with global boolean in jquery
body: <p>I've a problem that I don't understand. correctLogin is a boolean to control the correct/incorrect login. The initial value is false, and recoverUser return a value. If this value not empty correctLogin is true.</p>
  
  <p>But correctLogin doesn't change. It is always false.</p>
  
  <p>The commented alert show me true if it is correct, but in recordLogin correctLogin is false again.</p>
  
  <p>My code:</p>
  
  <pre><code>$(document).ready(function(){
      $("#loginButton").click(function(){
      var correctLogin = false;
      $.ajax({
          type: "POST",
          url: "recoverUser.php",
          data: "nameUser="+$("#nameUser").val()+"&amp;passwordUser="+$("#passwordUser").val(),
          success: function(groupUser){
              if(groupUser=="") {
                  $("#add_err").html("Incorrect Data");
              } else {
                  $("#add_err").html("Correct Data...")               
                  sessionStorage.setItem('sesionGrupo',groupUser);
                  sessionStorage.setItem('sessionUser',$("#nameUser").val());
                  sessionStorage.setItem('sessionPassword',$("#passwordUser").val());
                  correcLogin = true;
                  // alert(correctLogin);
              }
          },
      }); 
      $.ajax({
          type: "POST",
          url: "recordLogin.php",
          data: "nameUser="+$("#nameUser").val()+"&amp;statusLogin="+correctLogin,
          success: function(){
          },          
      });         
  });
  </code></pre>