php 弹框

WBOY
WBOYOriginal
2016-06-20 12:35:221171browse

if($mail -> Send()){    echo "<script>alert('Success')</script>";    header("Location: homeConnect.php");}else{    echo "<script>alert('Failed')</script>";    header("Location: homeConnect.php");}


不管成功还是失败,都没有弹框直接跳转了
想要的效果:显示弹框信息,用户点确定后跳转


回复讨论(解决方案)

要改成这样的
echo "<script>alert('Failed')</script>";
echo "<script>location: homeConnect.php</script>";

header("Location: homeConnect.php");
在 http 头中产生跳转指令,所以跳转发生于脚本执行之前

要改成这样的
echo "<script>alert('Failed')</script>";
echo "<script>location: homeConnect.php</script>";

header("Location: homeConnect.php");
在 http 头中产生跳转指令,所以跳转发生于脚本执行之前



不会跳转

echo "<script>location.href= 'homeConnect.php';</script>";

用script跳转

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn