jQuery & PHP: Running action in background
- by Azzyh
Hi, so I want to do something like when you press on LogOut, you get a waiting message like "please wait.." while its running ucp.php?mode=logout in the background, and after it has loaded that it should refresh the site.
How should this be done??
I am new to jquery, but so far i gave my link a ID, called #logout, made a <div id="message"></div> and then in jquery i did:
jQuery(document).ready(function(){
$('#tryout').click(function () {
logOut();
});
function logOut() {
var postFile = 'ucp.php?mode=logout';
$.post(postFile, function(data){
$("#message").fadeIn('slow');
});
}
Now is this right? And the line with #message, where it fades in, i don't really think its right because where's should i write the "Please wait" and the refresh part?
Please help me