开发者

How to submit the form via post and open the target page in an iframe

开发者 https://www.devze.com 2023-04-10 02:47 出处:网络
I have a form which redirects toa new page index.aspx after posting .However instead of opening the new page in a new window,I would like to open it as an ifra开发者_运维技巧me so that it remains in t

I have a form which redirects to a new page index.aspx after posting .However instead of opening the new page in a new window,I would like to open it as an ifra开发者_运维技巧me so that it remains in the current window

How do I go about that. The current code is :

     <form id="Form2" action="index.aspx" method="post" name="Form2" >
.....

<input type="image" style="border-width: 0px;" src="images/form_ordernow_btn.jpg"
                tabindex="129" id="Form1_ImageButton1" name="Form1$ImageButton1"  >

I am using asp.net by the way


Put the form into the iframe already. So the postback will open in the same iframe...

@Edit: if the form must be on the same page but cannot be in the iframe at the time of posting, the following solution may work:

  • postback to the same(!) page
  • insert the iframe into the page on the server
  • give the iframe an url according to the postdata i.e. change POST -> GET data
  • construct the target page (index.aspx) that way to handle the GET parameters
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号