如何在iframe中提交html / php表单后重新加载html(联系我们)表单

时间:2013-06-27 06:50:34

标签: html jquery iframe ajax4jsf html-formfu

我的html页面中有一个联系表单。在一个带有html联系人表单的iframe src中.once联系我们表单提交到thanks.php表单。输出将是来自thanks.php文件的html感谢消息正在显示。现在我的要求是在显示此感谢消息5秒后,我需要重新加载contactus html表单。

请在此帮助我

2 个答案:

答案 0 :(得分:0)

这可以通过JavaScript完成。将计时器设置为5秒,并将窗口位置设置为“联系我们”页面。这是你如何做到这一点:

<script type="text/javascript">
    // Set timeout to 5 seconds, measured in milliseconds
    setTimeout(function () {
        window.location = "contactus.html"; // relative URL
    }, 5000);
</script>

答案 1 :(得分:0)

你可以在thanks.php

中使用这个php代码
header( "refresh:5;url=contactus.html" );

这将每隔5秒将您重定向到contactus.html,但如果您打印的信息不足,则此功能无效,因为header()仅在运行前没有任何输出时才有效,

所以现在你可以使用javascript,

setTimeout(function () {
   window.location.href= 'http://localhost/xxx/contactus.html'; // the redirect goes here

},5000); // 5 seconds

将此脚本放在thankyou.php文件中。

更新: 元标记也可用于thankyou.php 只需将此行放在<head>部分

 <meta http-equiv="refresh" content="5;url=http://www.yoursite.com">