无法使用甜蜜警报单击“确定”
Not able to click OK using sweet alert
代码:
<script>
swal('Your ORDER has been placed Successfully!!!');
window.location="index.php";
</script>
Sweet alert 工作正常并重定向到页面,但问题是 alert 不允许单击“确定”并重定向到页面。
有什么办法吗??
当 sweetAlert 关闭时,您的示例页面将被重定向到 index.php。您是否单击了确定或取消按钮并不重要。您必须使用 sweetAlert 的事件来控制 "OK" 点击事件。
试试这个解决方案:
swal({
title: "Are you sure?",
text: "Some description",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, please redirect the page!",
closeOnConfirm: false
}, function() {
location.href="http://google.com"
});
代码:
<script>
swal('Your ORDER has been placed Successfully!!!');
window.location="index.php";
</script>
Sweet alert 工作正常并重定向到页面,但问题是 alert 不允许单击“确定”并重定向到页面。
有什么办法吗??
当 sweetAlert 关闭时,您的示例页面将被重定向到 index.php。您是否单击了确定或取消按钮并不重要。您必须使用 sweetAlert 的事件来控制 "OK" 点击事件。
试试这个解决方案:
swal({
title: "Are you sure?",
text: "Some description",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, please redirect the page!",
closeOnConfirm: false
}, function() {
location.href="http://google.com"
});