在iframe中提交后重新加载父页面(javascript / jquery) [英] Reload parent page after submit in iframe ( javascript/jquery )

查看:317
本文介绍了在iframe中提交后重新加载父页面(javascript / jquery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这个问题有同样的问题..(这个问题没有正确的答案,我只是测试了所有这些问题)



在iframe中提交后重新加载页面(javascript / jquery)



我需要的是非常好的解释,我在表单中有一个按钮,所有这些都在iframe(同一个域)内,我需要重新加载父页面,紧随iframe完成孔提交过程之后,我不想削减或打断它。谢谢

更新
继续搜索,我发现这..但我不能理解正确答案中的代码,是为asp ?,即时通讯php。

重新加载在iframe(javascript / jquery)中提交后的页面

http://dotnetspidor.blogspot.mx/2011/07/refresh-parent-page-partially-from.html

解决方案

在iframe中提交表单

 < form method =POSTaction =getForm.php> 

页面重新加载到getForm.php中,并在该文件中执行:

 <?php 

$ input = $ _POST ['input'];
//处理表单并执行你的操作等

echo<!DOCTYPE html>;
echo< head>;
回显< title>表单提交< /标题>;
echo< script type ='text / javascript'> window.parent.location.reload()< / script>;
echo< / head>;
echo< body>< / body>< / html>;

?>

并且会在表单提交后重新加载父页面,现在唯一的问题是,为什么如果您要重新加载父页面,则通过iFrame提交。


i have the same issue on this question.. (wich have no correct answer , i just test all of them)

Reload page after submit in iframe (javascript/jquery)

What i need is very good explained there, i have a button in form, all this inside an iframe (same domain) and i need to reload parent page, just after the iframe has made the hole submit process, i do not want to "cut" it or interrupt it. thanks

UPDATE Keep searching and i found this.. but i cant understand the code in the correct answer, is that for asp?, im on php.

Reload page after submit in iframe (javascript/jquery)

http://dotnetspidor.blogspot.mx/2011/07/refresh-parent-page-partially-from.html

解决方案

Once the form has been submitted in the iframe

<form method="POST" action="getForm.php">

The page reloads into getForm.php, and in that file you do:

<?php

    $input = $_POST['input'];
    // process form and do your stuff etc

    echo "<!DOCTYPE html>";
    echo "<head>";
    echo "<title>Form submitted</title>";
    echo "<script type='text/javascript'>window.parent.location.reload()</script>";
    echo "</head>";
    echo "<body></body></html>";

?>

and that would reload the parent page after the form has submitted, now the only question is, why are you submitting through an iFrame if you're going to reload the parent page anyway.

这篇关于在iframe中提交后重新加载父页面(javascript / jquery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆