views:

18

answers:

2

Im having a webpage with an iframe with form in it. I want to submit the form and get the result. How can i do it with jquery?

<iframe src ="html_intro.asp" width="100%" height="300">
  <form action="submit.php">
  <input type="text" name="name" />
  </form>
</iframe>
A: 

If the iframe is hosted on a domain different than the parent domain you cannot manipulate it with javascript. To submit the form from within the iframe you could use the submit method:

$('#yourFormId').submit();
Darin Dimitrov
+1  A: 

Try this:

$('#iframe_id').contents().find('form')[0].submit();

It is assumed that your are NOT hosting other domain in your iframe.

Sarfraz