的fancybox阿贾克斯岗位的iframe [英] fancybox ajax post to iframe

查看:119
本文介绍了的fancybox阿贾克斯岗位的iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可能使用的fancybox 张贴VAR的IFRAME打开时?

is it possible using fancybox to post a var to the iframe when opens?

我目前有:

function fancyBoxLoad(element) {
    var elementToEdit = $("#" + $(element).attr("class"));
    var content = encodeURIComponent($(elementToEdit).outerHTML());
    $.fancybox(
        { 'href': 'loadEditor.php' },
        {
            frameWidth: 750,
            frameHeight: 430,
            overlayShow: true,
            ajax: {
                type: "POST",
                data: 'content=' + content
            },
            type: 'iframe'
        }
    );
}

这似乎是,如果我拿走键入:IFRAME将发布的数据,但它不会出现在的iframe,如果我拿走 AJAX:{类型:POST数据:内容='+内容} 相反,它会在iframe打开,但没有发布数据(上面的例子不相同)

It does seem that if I take away type: 'iframe' it will post data but it doesn't appear to be in the iframe and if I take away ajax: { type: "POST", data: 'content=' + content } instead it will open in an iframe but not post the data (the example above does the same)

所以我的问题的存在能不能做到?

So my question being can it be done?

推荐答案

如果你只是试图把内容在一个iframe中,你为什么不使用的fancybox创建的iframe,一旦你知道它被创建年代,然后通过这个的fancybox返回到你和设置您的内容,方式,参考访问它。我不知道你要发送的内容到服务器和背部。只是等待的iframe来加载,然后准备好了,在它查询的元素,并设置内容。

If you're simply trying to put content in a iframe, why don't you use fancybox to create the iframe, and once you know it's been created, then access it via the reference that fancybox returns to you and set your content that way. I'm not sure you want to send the content to the server and back. Just wait for the iframe to load, then on ready, query an element within it and set the content.

这篇关于的fancybox阿贾克斯岗位的iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆