Php 如何在使用iframe时重定向onclick
在操作完成之前,我必须使用iframe来阻止页面重新加载。但是,我需要在操作发生后刷新它。为此,我尝试了两种方法:刷新页面和重定向到同一页面 PHP: HTML:Php 如何在使用iframe时重定向onclick,php,html,iframe,Php,Html,Iframe,在操作完成之前,我必须使用iframe来阻止页面重新加载。但是,我需要在操作发生后刷新它。为此,我尝试了两种方法:刷新页面和重定向到同一页面 PHP: HTML: <iframe width="0" height="0" border="0px solid white" style="display:none" name="iframe1" id="iframe1"></iframe> <form action="index.php" method
<iframe width="0" height="0" border="0px solid white" style="display:none" name="iframe1" id="iframe1"></iframe>
<form action="index.php" method="post" target="iframe1">
<input type="submit" href="" style="margin-top:5px" name="btn_name" class="btn btn-success" value="Enter">
</form>
谢谢你的帮助。所有的意见都很感谢
$\u POST['btn']
不发布任何内容,因为它是一个类
尝试
$\u POST['installer4\u btn']
。尝试将此添加到您的iframe所在的页面中(使用jquery)
$('#iframe1').load(function(){
如果(this.contentWindow.location.href=='http://location_redirected_in_php') {
window.location.href='/redirect_location';
}
});代码>这实际上会在iframe重新加载时向其添加一个侦听器,因此如果在成功提交或使用php处理后重新加载页面,则只需获取它将结束的位置并检查它,如果iframe具有该url,则重新加载父页面。为了更好地衡量,它应该是“header”(“location:index.php”)`
<iframe width="0" height="0" border="0px solid white" style="display:none" name="iframe1" id="iframe1"></iframe>
<form action="index.php" method="post" target="iframe1">
<input type="submit" href="" style="margin-top:5px" name="btn_name" class="btn btn-success" value="Enter">
</form>