Autolycus Autolycus - 1 year ago 84
Javascript Question

form not posting to iframe back

This should have been pretty simple but I have spent a few hours trying to figure out why a simple form post would not end up in the iframe instead of a new window.

I am trying to post data to and I want the reponse to be back in the iframe. However it opens a new window. I am not sure what else to do. here is my code

<script src=""></script>

<form method="post" name="test-form" id="test-form" target="myIframe" action="">
<input type="text" name="x_login">
<input type="text" name="x_fp_sequence">
<input type="text" name="x_fp_timestamp">
<input type="text" name="x_amount">
<input type="text" name="x_fp_hash">
<input type="text" name="x_show_form">
<input type="text" name="x_test_request">
<input type="text" name="x_type">
<input type="text" name="x_currency_code">
<input type="text" name="x_invoice_num">
<input type="text" name="x_description">
<input type="text" name="x_first_name">
<input type="text" name="x_last_name">
<input type="text" name="x_company">
<input type="text" name="x_address">
<input type="text" name="x_city">
<input type="text" name="x_state">
<input type="text" name="x_zip">
<input type="text" name="x_country">
<input type="text" name="x_phone">
<input type="text" name="x_email">
<input type="text" name="x_relay_response">
<input type="text" name="x_solution_id">
<iframe src="" name="myIframe></iframe>



Answer Source

By putting your code in Plunker, there is a syntax error at line 37:

<iframe src="" name="myIframe></iframe>  
                             ^-- missing "

After adding the closing quote, I can see the page loaded in the iFrame :)

You may want to consider changing to use an IDE which may help you identifying typos, so that hours can be saved.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download