Using JS to POST a form in an iframe.
Posted
by Stavros Korokithakis
on Stack Overflow
See other posts from Stack Overflow
or by Stavros Korokithakis
Published on 2010-06-08T21:00:18Z
Indexed on
2010/06/08
21:02 UTC
Read the original article
Hit count: 287
I would like to POST a form in an iframe, generated like so:
My JS loads an iframe inside the page, adds a form to the iframe and submits the form. What I would like to happen is the iframe to load the result of that request. So, I would effectively like to post a form and render the result inside the iframe, without touching the parent (apart from putting the iframe up for display in the first place).
I am using the code from this answer:
http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit/134003#134003
but I can't get it to not reload the parent. I post the form, and instead of the iframe refreshing, the entire parent refreshes. I don't know why that is, since the url it's posting to is different and would at least redirect there.
Can anyone help me with this problem? I just want a post inside an iframe and only within the iframe, basically.
© Stack Overflow or respective owner