bootstrap 模式关闭后如何重新加载页面

How to reload page after bootstrap modal closed

$("#customerAdded").modal("show").on("shown.bs.modal", function () {
                window.setTimeout(function () {
                    $("#customerAdded").modal("hide");
                }, 5000);
                location.reload();                  
            });

好的,它有效。但是对于 location.reload(),尽管我更改了时间,但页面会立即重新加载。 我会在模式关闭后根据指定的时间重新加载页面。

这是代码

$('#customerAdded').on('hidden', function () {
    location.reload();
})

您可以在隐藏模态时触发 location.reload():

$("#customerAdded")
.modal("show")
.on("shown.bs.modal", function () {
    window.setTimeout(function () {
        $("#customerAdded").modal("hide");
        location.reload(); 
    }, 5000);                 
});
$("#customerAdded").modal("hide").on("hidden.bs.modal", function () {        
        location.reload();                   
});