如何在我的脚本中使用fadeOut函数后刷新页面?

时间:2011-08-29 09:49:35

标签: jquery html

fadeOut效果发生/发生后如何刷新页面? 这就是我现在所拥有的,

$.ajax({
    type: "POST",
    url: 'classes/ajax.login.php',
    data: "username=" +username+ "&password="+password,
    success: function(msg){
        if(msg == 'success'){
            $('div#login').fadeOut('normal');

        } else {
            alert(msg);
        }
    },
});

1 个答案:

答案 0 :(得分:4)

将其添加为回调

$.ajax({
    type: "POST",
    url: 'classes/ajax.login.php',
    data: "username=" +username+ "&password="+password,
    success: function(msg){
        if(msg == 'success'){
            $('div#login').fadeOut('normal', function(){
                     document.location.href = this.location.href
            });

        } else {
            alert(msg);
        }
    },
});