我想让我的提示消息更花哨或更好。我在我的项目中使用 PHP 作为我的后端,但我只是在成功操作后使用正常的提示警报。这里就不包含所有代码了,只放在sweetalert js部分。
更新操作成功后。我想在更新用户配置文件后使用 sweetalert swal 显示警告消息,当我单击 swal 中的确定按钮时,它将刷新页面以查看更改。
echo "<script>swal('Successfully updated the profile!', 'Click ok to refresh the page.', 'success');
window.location='preschooler_profile.php?p_id=$p_id'</script>";
更新操作后,服务器中的一切正常。但是 sweetalert 的提示 alert swal 不会弹出。但是当我试图测试我的 html 文件顶部的 sweetalert 及其工作时。所以 sweetalert 没有问题可能是因为 window.location?
寻求帮助。 提前致谢。
最佳答案
你为什么不尝试回显这个呢?
swal({
title: "Successfully updated the profile!",
text: "Click ok to refresh the page.",
type: "success"
},
function(){
window.location='preschooler_profile.php?p_id=$p_id'
});
关于javascript - 在 php 中更新后,Sweetalert JS 重定向窗口位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46022234/