使用iFrame中的Fancybox Ajax功能提交表单

Sta*_*umo 3 ajax jquery fancybox

我想使用Fancybox在iFrame中显示注册表单.一旦用户填写了他/她的详细信息.

应使用Jquery/Fancybox中的ajax机制以及同一Fancybox iframe中显示的值来处理详细信息.

这怎么可以实现,我整天都在摸不着头脑,我不知道我哪里出错了.

以下是我的代码

$("a.interested").fancybox({
                'width': 400,
                'height': 400,
                'enableEscapeButton' : false,
                'overlayShow' : true,
                'overlayOpacity' : 0,
                'hideOnOverlayClick' : false,
                'type': 'iframe',
                 ajax: {
                           type     : "POST",
                           cache    : false,
                           url      : "/components/profile/buyer/regbuyer1.php",
                           success: function(data) {
                                $.fancybox(data);
                            }
                        }
            });
Run Code Online (Sandbox Code Playgroud)

一些代码示例确实会有所帮助.

感谢名单

小智 7

$("a.interested").click(function(){

    $.ajax: {
        type     : "POST",
        cache    : false,
        url      : "/components/profile/buyer/regbuyer1.php",
        success: function(data) {
            $.fancybox({
                'width': 400,
                'height': 400,
                'enableEscapeButton' : false,
                'overlayShow' : true,
                'overlayOpacity' : 0,
                'hideOnOverlayClick' : false,
                'content' : data
            });
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

来自http://fancybox.net/blog


小智 6

我们的想法是你在fancybox中打开iframe,然后在iframe中使用常规帖子,因为iframe中的所有请求都将保留在iframe中.

所以你在代码中所要做的就是:

$("a.interested").fancybox({
                'width': 400,
                'height': 400,
                'enableEscapeButton' : false,
                'overlayShow' : true,
                'overlayOpacity' : 0,
                'hideOnOverlayClick' : false,
                'type': 'iframe',
                'href': "/components/profile/buyer/regbuyer1.php" //or any other url that contains the contents of that iframe
            });
Run Code Online (Sandbox Code Playgroud)