在 AJAX 成功后刷新页面



此脚本是我网站的一部分,为什么不刷新页面?

我测试了堆栈溢出上可用的其他方法,但是没有回答。

帮助我,谢谢

$(document).ready(function (e) {
    $("#loginform").on('submit',(function(e) {
    var show_result_ajax = $("#show-result-ajax-loginform");
        e.preventDefault();
        $.ajax({
            url: "inc/custom/login.php",
            type: "POST",
            data: new FormData(this),
            contentType: false,
            cache: false,
            processData:false,
            success: function(data)
            {
                if(data != 'empty_error'){
                   show_result_ajax.fadeOut(function(){
                          show_result_ajax.html(data);
                   });
                   show_result_ajax.fadeIn();
                }
                else
                if(data == 'empty_error'){
                    window.location.reload();
                }

            }
        });
    }
));
});

试试这个

$(document).ready(function (e) {
    $("#loginform").on('submit',(function(e) {
        e.preventDefault();
        var show_result_ajax = $("#show-result-ajax-loginform");
        $.ajax({
            url: "inc/custom/login.php",
            type: "POST",
            data: new FormData(this),
            contentType: false,
            cache: false,
            processData:false,
            success: function(data)
            {
                if(data != 'empty_error'){
                    show_result_ajax.fadeOut(function(){
                        show_result_ajax.html(data);
                    });
                    show_result_ajax.fadeIn();
                }
                else if(data == 'empty_error'){
                    location.reload();
                }
            }
        });
        return false;
    }));
});

最新更新