单击甜蜜警报上的确定按钮后如何重定向页面?

编程入门 行业动态 更新时间:2024-10-25 20:22:21
本文介绍了单击甜蜜警报上的确定按钮后如何重定向页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我可以在页面刷新后显示甜蜜警报,但是我必须单击确定按钮,我会在甜蜜警报上重定向页面。请帮助我。

I am able to display sweet alert after the page refresh but I have to click on Ok button which I am getting on sweet alert to redirect the page.Please help me in this.

<?php echo '<script type="text/javascript">'; echo 'setTimeout(function () { swal("WOW!","Message!","success");'; echo '}, 1000);' echo 'window.location.href = "index.php";'; echo '</script>'; ?>

推荐答案

要指定回调函数,您必须使用object作为第一个参数,回调函数作为第二个参数。

To specify a callback function, you have to use an object as the first argument, and the callback function as the second argument.

echo '<script> setTimeout(function() { swal({ title: "Wow!", text: "Message!", type: "success" }, function() { window.location = "redirectURL"; }); }, 1000); </script>';

更多推荐

单击甜蜜警报上的确定按钮后如何重定向页面?

本文发布于:2023-11-27 15:51:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1638636.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   单击   重定向   按钮   甜蜜

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!