在iframe中提交后重新加载父页面

问题描述:

我在这个问题上也有同样的问题.(没有正确答案,我只是测试所有答案)

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

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

我需要的东西在这里很好地解释了,我在窗体中有一个按钮,所有这些都在一个iframe(相同的域)内,我需要重新加载父页面,只是在iframe完成了孔提交过程之后,我没有想要削减"还是打断它.

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.

更新:继续搜索,我发现了这一点.但是我无法理解正确答案中的代码,这是针对asp吗?我在使用PHP.

UPDATE: Keep searching and I found this. But I can't understand the code in the correct answer, is that for asp? I'm on PHP.

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

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

表单已在iframe中提交

Once the form has been submitted in the iframe

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

页面重新加载到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>";

?>

这将在提交表单后重新加载父页面,现在唯一的问题是,如果仍然要重新加载父页面,为什么要通过iFrame提交.

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.