将数据发布到colorbox iframe? [英] Posting data to a colorbox iframe?

查看:122
本文介绍了将数据发布到colorbox iframe?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在使用的代码。从我见过的其他例子来看,这应该有效,但事实并非如此。并且已经确定我使用的是最新的彩盒。

Here is the code I'm working with. From other examples I've seen, this should work but it is not. And have already made sure that I am using the latest colorbox.

function updateFolderCate(ID,Type){
    $.colorbox({
        iframe:true,
        scrolling: false,
        innerWidth:'100',
        innerHeight:'100',
        href:"page.php",
        data:{LinkID:ID,itemType:Type},
        onClosed:function(){
            //Do something on close.
        }
    });
}


推荐答案

您将iframe设置为true 。这样做会打开一个颜色框,创建一个iframe,并将iframe的src属性设置为href指定的位置。所以逻辑上这不能做POST请求。这可能会达到你想要的效果,但我不确定。

You are setting iframe to true. What this does is opens a colorbox, creates an iframe, and sets the src attribute of the iframe to the location specified by href. So logically this can't do POST requests. This might accomplish what you want but I'm not sure.

function updateFolderCate(ID,Type){
    $.colorbox({
        open: true,
        scrolling: false,
        innerWidth:'100',
        innerHeight:'100',
        href:"page.php",
        data:{LinkID:ID,itemType:Type},
        onClosed:function(){
            //Do something on close.
        }
    });
}

这可能不像iframe方法那样,你可以必须重新修改你的终点。如果您的端点不必接收POST请求,那么请使用earlonrails的回答。

This isn't going to behave exactly like the iframe method does, you may have to rework your endpoint. If your endpoint doesn't HAVE to only receive POST requests then go with earlonrails' answer.

编辑:我在潜水源代码后来到这里:来源

I came to this after diving the source code: Source

相关的行是第800行和第856行.iframe和href似乎不兼容,所以我检查了Firebug中加载的元素,发现它是一个iframe,src属性设置为href变量。

The relevant lines are line 800 and line 856. iframe and href didn't seem compatible, so then I inspected the element that was loaded in Firebug and noticed it was an iframe with the src attribute set to the href variable.

这篇关于将数据发布到colorbox iframe?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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