开发者

jQuery & PHP: Running action in background

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开发者_StackOverflow社区 () {
        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


function logOut()  { 
  var postFile = 'ucp.php?mode=logout';
  $("#message").fadeIn('slow');
  $.post(postFile, function(data){
        window.location.reload();
  });
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜