引导data-dismiss =“alert"——然后重定向到另一个页面
bootstrap data-dismiss="alert" -- and redirect the other page
我有以下PHP和HTML与BS代码:
<?php if (isset($_GET['register']) && $_GET['register'] == 'get') {?>
<div class="alert alert-danger success">
<button type="button" class="close" data-dismiss="alert" onclick="return refresh('index.php')">×</button>
<strong>The register must be done with GET!</strong>
</div>
<?php }?>
通过$_GET superglobal将错误从register.php发送到index.php,该错误在index.php中使用上述代码"捕获"。此时,我的URL是index.php?register=get
。我想要两个东西:
- 用class="alert"(已经完成)取消div
- 当报警-危险信息的小"x"被按下时,重新加载页面,使?register=get消失,URL变成简单的:index.php
直到现在我已经试过了:
JS函数用"onclick" HTML属性调用
function refresh(page){ return window.location.href(page); }
<button type="button" class="close" data-dismiss="alert" id="close1">×</button>
和我使用以下jquery代码:
$("#close1").on("click", function () {
window.location.href("http://localhost/ampera/src/supervizor/app/sef_locatie_nou.php");
});
我使用绝对和相对路径的jquery代码,没有工作。并且该代码只忽略警报-危险消息,而不根据需要重新加载页面。
尝试窗口。开放:
window.open("http://localhost/ampera/src/supervizor/app/sef_locatie_nou.php", "_self");
演示:http://jsfiddle.net/Rj9bR/54/try this
$("#close1").on("click", function () {
location.assign("http://localhost/ampera/src/supervizor/app/sef_locatie_nou.php");
});
相关文章:
- 我想重定向点击,然后更改按钮文本,我该怎么做
- javascript:发送带有音频文件的POST,然后重定向到新页面
- 将jsp重定向到servlet,然后重定向到下一页
- jQuery移动显示页面5秒钟,然后重定向
- 谷歌分析调用然后用javascript重定向
- Javascript按钮,它提交联系人表单7表单,然后重定向到URL
- 选择其中一个单选按钮,然后单击“提交”,重定向其他页面
- 如何提交表单,然后重定向为提交
- 每次我点击我的网站,它都会重定向到home.html,然后返回到我点击的所需url
- 一次选中4个复选框,然后将页面重定向到新页面
- 如何在新窗口中提交表单,然后重定向父页面
- Javascript表单提交打开新窗口选项卡,然后重定向父页面
- 检查页面上的文本,然后重定向
- 在 中显示警告框 asp.net 将重定向到空白页,然后返回到原始页面
- 使用 Ajax POST 查询 MVC 控制器,然后使用模型重定向
- 创建一个超链接(或按钮),用于执行 python 脚本,然后在脚本完成时重定向
- 当将页面提交到谷歌表单时,它将打印结果,然后使用 javascript 重定向到主页
- Javascript重定向然后显示一条消息
- 替换历史记录,然后在 AngularJS 中重定向
- 如何重定向然后在节点.js中停止