I have a page that contains a dynamically loaded <iframe>. This iframe contains a <form>.
When the user submits the <form>, a new page is loaded within the <iframe> saying Thanks.
Instead of using a second page, i want the parent page to show the Thanks message.
So basically i am in my <iframe>, and i want to call a function on the parent frame.
How can i do that ?
I’ve done a little example for you.
Here is the main page (index.html) containing the iframe
And here is the iframe (iframe.html):
EDIT : An alternative is to create a function inside the main page and call it in the iframe using
parent.nameOfTheFunction()The main page (index.html)
The iframe (iframe.html):