开发者

Loading the contents of an iframe with jQuery

开发者 https://www.devze.com 2023-02-19 11:22 出处:网络
I am trying to load the entire content of a child iframe upon some action in the parent frame. I am using jQuery and I am trying to avoid using <form> tag, setting up bunch of hidden <input&g

I am trying to load the entire content of a child iframe upon some action in the parent frame. I am using jQuery and I am trying to avoid using <form> tag, setting up bunch of hidden <input> tags and submitting it. instead, I want to use something similar to jQuery's:

.load(url, data,function(response){...})

or perhaps

.p开发者_JAVA百科ost(url, data,function(response){...})

so far I tried the 'post' method and tried to use jQuery's .contents() method to change the contents of my iframe with the response that I get but the problem is that i need to change the entire content (ie the whole document) of the iframe and .contents() method returns the document object of the iframe. all I can do is to change the content of the document (ie say <head> or <body>). note that my iframe initially has no src attribute so initially there is no content to it.


Set the SRC of the iframe:

$('#someIframe').attr('src','http://....')
0

精彩评论

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