How do you post data to an iframe?
I'd imagine that you would dynamically generate a form within the iframe, and then post that.
Here's a discussion on doing that for a top-level page:
http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit
You should be able to modify it to create the form within an iframe instead.
An iframe is an html element. In common language, we say that you would post to a page, not a iframe. Whatever the source (src) of the iframe is--try putting that URL as the action of your form.
Depends what you mean by "post data". You can use the HTML target="" attribute on a <form /> tag, so it could be as simple as:
<form action="do_stuff.aspx" method="post" target="my_iframe">
<input type="submit" value="Do Stuff!" />
</form>
<!-- when the form is submitted, the server response will appear in this iframe -->
<iframe name="my_iframe" src="not_submitted_yet.aspx"></iframe>
If that's not it, or you're after something more complex, please edit your question to include more detail.
Hi Dylan Beattie,
This method does not work in I.E.7. I think I.E.7 does not support target attribute.