Jquery : 等待 toastr 通知结束然后重新加载
Jquery : Wait for the toastr notification to end then reload
我正在使用 ajax 因为模态形式,
ajax 成功时我有一个 toastr 通知。
toastr.success("We will get back to you with response, Thanks !");
然后:
window.location.reload();
如何才能让通知先结束再重新加载。
我找到了一些东西,但它很快就重新加载了页面:
$.when( toastr.success("We will get back to you with response, Thanks !") ).then(function( data, textStatus, jqXHR ) {
window.location.reload();
});
还有其他suitable/Best练习方法吗?
伟大的toastr已经有隐藏动画结束的回调:
toastr.options.timeOut = 1000;
toastr.options.fadeOut = 1000;
toastr.options.onHidden = function(){
// this will be executed after fadeout, i.e. 2secs after notification has been show
window.location.reload();
};
编辑:
您也可以只覆盖一个吐司:
toastr.success(
'Have fun!',
'Miracle Max Says',
{
timeOut: 1000,
fadeOut: 1000,
onHidden: function () {
window.location.reload();
}
}
);
我正在使用 ajax 因为模态形式, ajax 成功时我有一个 toastr 通知。
toastr.success("We will get back to you with response, Thanks !");
然后:
window.location.reload();
如何才能让通知先结束再重新加载。 我找到了一些东西,但它很快就重新加载了页面:
$.when( toastr.success("We will get back to you with response, Thanks !") ).then(function( data, textStatus, jqXHR ) {
window.location.reload();
});
还有其他suitable/Best练习方法吗?
伟大的toastr已经有隐藏动画结束的回调:
toastr.options.timeOut = 1000;
toastr.options.fadeOut = 1000;
toastr.options.onHidden = function(){
// this will be executed after fadeout, i.e. 2secs after notification has been show
window.location.reload();
};
编辑:
您也可以只覆盖一个吐司:
toastr.success(
'Have fun!',
'Miracle Max Says',
{
timeOut: 1000,
fadeOut: 1000,
onHidden: function () {
window.location.reload();
}
}
);