问题
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
回答1:
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.
回答2:
all that you need to do is add the below line,
window.parent.location.reload();
at the end of the function that is called onclick of your submit button.
来源:https://stackoverflow.com/questions/20507015/reload-parent-page-after-submit-in-iframe-javascript-jquery