从IFRAME的fancybox上找到的网站元素 [英] Find element on site from a fancybox iframe
本文介绍了从IFRAME的fancybox上找到的网站元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的网站从的fancybox更新的元素。在的fancybox我做了 $。员额()
,并取回 HTML
,我想在一个div来填充数据在我的网页。我打开了一个 IFRAME
窗口 HTML
和下面这个脚本是在 IFRAME
。它不能从的fancybox发现它所以任何人都得到了关于如何达成元素的想法或解决方案,那不是里面的fancybox IFRAME
?
$('添加到购物车')。点击(函数(){
变量$此= $(本).closest(形式); $。员额($ this.attr('行动'){数量:$ this.find('#quantity_id)VAL()},功能(数据){
。父$ fancybox.close()。
$('#集装箱')HTML(数据)。
},'HTML'); 返回false;
});
解决方案
试试这个:
$('#集装箱',$(parent.document))HTML(数据);
I'm trying to update a element on my site from a fancybox. In the fancybox i do a $.post()
and get back html
data that i want to populate in a div on my page. I open up a iframe
window with html
and this script below is in that iframe
. It cant find it from the fancybox so anybody got idea or solution on how to reach a element thats not inside the fancybox iframe
?
$('.add-to-cart').click(function () {
var $this = $(this).closest('form');
$.post($this.attr('action'), { quantity: $this.find('#quantity_id').val() }, function (data) {
parent.$.fancybox.close();
$('#container').html(data);
}, 'html');
return false;
});
解决方案
Try this:
$('#container', $(parent.document)).html(data);
这篇关于从IFRAME的fancybox上找到的网站元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文