Fil*_*Fil 6 php ajax jquery sweetalert
您好我有一个使用sweetalert的代码
swal("Good job!", "You clicked the button!", "success")
Run Code Online (Sandbox Code Playgroud)
这段代码会弹出一条消息并且有一个按钮没关系,我喜欢做的是我想点击okay按钮后刷新页面.
我能这样做吗?
Yos*_*oka 20
你可以尝试这个,它的工作对我来说..
swal({title: "Good job", text: "You clicked the button!", type: "success"},
function(){
location.reload();
}
);
Run Code Online (Sandbox Code Playgroud)
小智 17
吉冈的答案对我不起作用,我这样做了,它完美地运作了:
swal({title: "Good job", text: "You clicked the button!", type:
"success"}).then(function(){
location.reload();
}
);
Run Code Online (Sandbox Code Playgroud)
小智 11
使用回调函数...
Swal.fire({
// Swal Setting's
}).then((result) => {
// Reload the Page
location.reload();
});
Run Code Online (Sandbox Code Playgroud)
对于 Sweet Alert 2,这将有效。
swal("Good job!", "You clicked the button!", "success").then(function(){
location.reload();
});
Run Code Online (Sandbox Code Playgroud)
如您所见,迁移指南
Sweet Alert 2 使用Promise
您可以通过以下方式检查确认:
swal({
title: "Good job",
text: "You clicked the button!",
icon: "success",
buttons: [
'NO',
'YES'
],
}).then(function(isConfirm) {
if (isConfirm) {
location.reload();
} else {
//if no clicked => do something else
}
});
Run Code Online (Sandbox Code Playgroud)
我使用甜蜜警报 2,这对我有用
swal("Good job!", "You clicked the button!","success").then( () => {
location.href = 'somepage.html'
})
Run Code Online (Sandbox Code Playgroud)
''' 使用 location.reload() 的答案将触发您的表单一次又一次地尝试重新提交,这就是您应该改用 location.href 的原因。
归档时间: |
|
查看次数: |
19143 次 |
最近记录: |