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

Mon*_*vez 3 html javascript php iframe jquery

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

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

我需要的是非常好的解释那里,我有一个形式的按钮,所有这一切在iframe(相同的域),我需要重新加载父页面,就在iframe已经进行了洞提交过程后,我不想"削减它或打断它.谢谢

更新继续搜索,我发现了这个..但我无法理解正确答案中的代码,是对于asp?,即时通讯在PHP上.

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

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

ade*_*neo 8

表单在iframe中提交后

<form method="POST" action="getForm.php">
Run Code Online (Sandbox Code Playgroud)

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

<?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>";

?>
Run Code Online (Sandbox Code Playgroud)

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


小智 6

您需要做的就是添加以下行,

window.parent.location.reload();
Run Code Online (Sandbox Code Playgroud)

onclick提交按钮调用的函数的末尾。

  • 已经提供并接受了相同的答案。这个答案有什么新内容? (2认同)