jQuery & PHP: Running action in background

Posted by Azzyh on Stack Overflow See other posts from Stack Overflow or by Azzyh
Published on 2010-06-16T10:18:56Z Indexed on 2010/06/16 10:22 UTC
Read the original article Hit count: 227

Filed under:

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

© Stack Overflow or respective owner

Related posts about jQuery