weixin_33736832 2009-12-12 09:46 采纳率: 0%
浏览 9

fancybox ajax发布到iframe

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

I currently have:

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'
        }
    );
}

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?

  • 写回答

2条回答 默认 最新

  • weixin_33698043 2009-12-15 01:54
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题
  • ¥15 用PLC设计纸袋糊底机送料系统
  • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
  • ¥15 用C语言输入方程怎么
  • ¥15 网站显示不安全连接问题
  • ¥15 51单片机显示器问题
  • ¥20 关于#qt#的问题:Qt代码的移植问题
  • ¥50 求图像处理的matlab方案