javascript - 登录尝试失败时的模式弹出窗口
问题描述
问题:
我有一个登录表单,它在登录前检查 3 个条件,如果通过正确,如果正确是用户启用或验证,我想要做的是在用户未验证时弹出一个联系我们模式然而。
action.php 的标头
header('location: control-panel.php');
}else{
header('location: index.php?inactive=');
}
}else{
header('location: index.php?dis');
}
}else{
session_start();
$_SESSION['isactive'] = false;
header('location: index.php?err=1');
}
mysqli_close($mysqli);
从表格页面
<?php
$error = 0;
if (isset($_REQUEST['err'])){
$error = $_REQUEST['err'];
}
$dis = echo '<script>
$(window).on('load',function(){
if (!sessionStorage.getItem('shown-modal')){
$('#myModal').modal('show');
sessionStorage.setItem('shown-modal', 'true');
}
});
</script> ;
$inactive = 'Sorry Your Account Has Not Been Activated Yet<br /> Check Your Mail And Click On The Activation Link To Activate Your Account';
?>
试图:
$dis = echo '<script>
$(window).on('load',function(){
if (!sessionStorage.getItem('shown-modal')){
$('#myModal').modal('show');
sessionStorage.setItem('shown-modal', 'true');
}
});
</script> ;
解决方案
它可能与"
and的用法有关'
:
尝试 1
echo "<script>
$(window).on('load',function(){
if (!sessionStorage.getItem('shown-modal')){
$('#myModal').modal('show');
sessionStorage.setItem('shown-modal', 'true');
}
});
</script>";
输出 1
<script>
$(window).on('load',function(){
if (!sessionStorage.getItem('shown-modal')){
$('#myModal').modal('show');
sessionStorage.setItem('shown-modal', 'true');
}
});
</script>
尝试 2
echo '<script>
$(window).on("load",function(){
if (!sessionStorage.getItem("shown-modal")){
$("#myModal").modal("show");
sessionStorage.setItem("shown-modal", "true");
}
});
</script>';
输出 2
<script>
$(window).on("load",function(){
if (!sessionStorage.getItem("shown-modal")){
$("#myModal").modal("show");
sessionStorage.setItem("shown-modal", "true");
}
});
</script>
推荐阅读
- ansible - 如何使用 YAML 配置带有 ansible 的 windows 服务器
- python - Python中的小费计算器
- docker - Docker 容器的带宽和磁盘空间
- neo4j - 使用密码查询 Neo4j 中关系的属性
- angular - Angular 和 Bootstrap 模板
- javascript - 修改 JQuery 函数以在单击时运行
- php - 为什么我的背景图像在不同的屏幕尺寸上不断变化?
- heroku - 错误:缺少必需的标志:-a,--app APP 应用程序来运行命令
- java - Tomcat 8 无法创建 Java jli.dll
- javascript - 给定一串字母,我如何计算每个字母的出现次数?