Target an iframe with a HTML Post with jQuery

前端 未结 7 2256
遥遥无期
遥遥无期 2020-12-08 07:50

If I\'m using jQuery or JavaScript to do a post, how can I make it target an iframe rather than the current page?

jQuery.post( 
    url, 
    [data], 
    [c         


        
7条回答
  •  独厮守ぢ
    2020-12-08 08:25

    Here's what I did to get around the issue of having a form within a form on a asp.net page when I needed to submit data to a remote page via a form ideally using AJAX / jQuery.

    1. I created variables to capture the asp.net form name, target, action, method, etc.

    2. I held that information from the form in those variables and then changed the form itself using jQuery to do what I needed it to do.

    3. Then I posted the form via AJAX (because I needed a form to post to a seperate page dynamically so the other page could GET the info).

    4. Finally, I changed the asp.net form back to the way it was so the rest of the page could work correctly.

    This seems to have resolved my need for a similar solution.

提交回复
热议问题