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?
The log out link is being loaded by the fist ajax call, could that be the problem?
Here is the log in jquery 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');
}
}
});
});
Here is the log out jquery 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');
}
});
});