Javascript 在php中更新后,Sweetalert JS重定向窗口位置

Javascript 在php中更新后,Sweetalert JS重定向窗口位置,javascript,php,sweetalert,Javascript,Php,Sweetalert,我想让我的即时消息更别致或更好。我在项目中使用PHP作为后端,但我只在成功操作后使用正常的提示警报。我不会在这里只在sweetalert js的一部分包含所有代码 更新操作成功后。更新用户配置文件后,我想使用sweetalert swal显示一条警报消息,当我单击swal中的ok按钮时,它将刷新页面以查看更改 echo "<script>swal('Successfully updated the profile!', 'Click ok to refresh the pag

我想让我的即时消息更别致或更好。我在项目中使用PHP作为后端,但我只在成功操作后使用正常的提示警报。我不会在这里只在sweetalert js的一部分包含所有代码

更新操作成功后。更新用户配置文件后,我想使用sweetalert swal显示一条警报消息,当我单击swal中的ok按钮时,它将刷新页面以查看更改

    echo "<script>swal('Successfully updated the profile!', 'Click ok to refresh the page.', 'success');
window.location='preschooler_profile.php?p_id=$p_id'</script>";
echo“swal('Successfully updated the profile!”,'Click ok to refresh the page','success');
window.location='preschooler\u profile.php?p\u id=$p\u id';
更新操作完成后,服务器中的一切工作正常。但是sweetalert发出的提示警报不会弹出。但是当我试图在我的html文件的顶部测试sweetalert及其工作时。所以sweetalert没有问题可能是因为窗口。位置

正在寻求帮助。
提前谢谢

你为什么不试着重复这个呢

   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'
    });
swal()的第三个参数是类型!试着这样做:

swal({
标题:“已成功更新配置文件!”,
文本:“单击“确定”刷新页面。”,
键入:“成功”,
confirmButtonText:“确定”,
closeOnConfirm:false
},location.reload.bind(location))

尝试在php中使用echo

swal({
标题:“已成功更新配置文件!”,
文本:“单击“确定”刷新页面。”,
类型:“成功”
},
函数(){
window.location='preschooler_profile.php?p_id=';
});

请在此处查看sweetalert文档。另外,记住在页面底部或$(document.ready()时回显函数