title: How to run an ajax call after another ajax call?
body: <p>Here is the problem that I am having. The user can log in but if they don't refresh the page they can not log back out. So how do I call another ajax call right after another? </p>
  
  <p>The log out link is being loaded by the fist ajax call, could that be the problem?</p>
  
  <p>Here is the log in jquery code:</p>
  
  <pre><code> $(".bt_login").click(function (){
       $.ajax({
              type: 'POST',
              url: 'widgets/Login/loginProcess.php',
              data: dataString,
              success: function(data){
                  if(data == 'error'){
                      alert('Wrong username and/or password!');
                  }else{
                      $('#loginForm').html(data);
                      $('#greet').html('Hello '+username+'!').fadeIn();
                      $('#open').html('Open Panel');
                  }
              }
          });
      });
  </code></pre>
  
  <p>Here is the log out jquery code:</p>
  
  <pre><code>$('.bt_logout').click(function (){
          var dataString = 'process=logout';
          $.ajax({
              type: 'POST',
              url: 'widgets/Login/loginProcess.php',
              data: dataString,
              success: function(data){
                  $('#loginForm').hide().html(data).fadeIn();
                  $('#greet').html('Hello Guest!');
                  $('#open').html('Log In | Register');
              }
          });
      });
  </code></pre>