【发布时间】:2011-03-20 03:19:09
【问题描述】:
我正在使用 $.ajax() 加载 iframe:
$("#iframe_wrapper").each(function(){
$.ajax({
type: "post",
url: "http://site.com",
data: { action: 'get_the_iframe' },
context: this,
success: function(html){
$(this).html(html);
$(this).show();
$('#theiframe').load(function(){
// do stuff with the iframe...
});
}
});
});
如果 $_POST['action'] 是 'get_the_iframe',则 iframe 位于一个函数中:
<iframe id="theiframe" name="theiframe" src="http://site.com/page/"></iframe>
它可以工作,但问题是浏览器似乎显示整个页面真的很慢,似乎它在显示页面上的整个内容之前等待 iframe 加载,这是不应该发生的,因为它已经完成了通过ajax。这正是我试图避免的......
有什么想法吗?
【问题讨论】:
标签: javascript ajax iframe jquery