Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refresh iframe parent page after a submit in the iframe?

i have iframe inside a page, and this iframe contain a submit button which will do some function.

What i want is: after the iframe submit finish, call the parent page to refresh.

i know how to refresh it:

parent.location.reload();

But i don't know how to do that after submit finish.

like image 735
Amr Elgarhy Avatar asked Dec 07 '09 15:12

Amr Elgarhy


1 Answers

Use an onload event handler on your iframe. When it fires after the submit, execute your top.location.reload...

// In parent
window.onload = function() {
  document.getElementById("MY_IFRAME").onload = function() {
    top.location.reload();
  }
}
like image 185
Josh Stodola Avatar answered Sep 19 '22 07:09

Josh Stodola