使用fancybox的AJAX帖子不起作用

时间:2012-02-23 18:17:11

标签: php jquery fancybox

我的剧本:

$("#sl_selections").fancybox({
    'width'             : 370,
    'height'            : 480,
    'autoDimensions'    : false,//(width != '' || height != '' ? false : true),
    'autoScale'         : false,
    'showCloseButton'   : false,
    'titleShow'         : false,
    'padding'           : 0,
    'href'              : $('#itemInteractivity .copyMove a').attr('href'),
    'ajax'              : { data:  acao,type: 'post' }
});  
PHP中的

返回一个空帖子。有趣的是,如果我这样做:

$.ajax({
    type:           'post',
    cache:          false,
    url:            $('#itemInteractivity .copyMove a').attr('href'),
    data:           {data:  acao}
});

工作正常,任何想法?

1 个答案:

答案 0 :(得分:0)

老问题,但没有可接受的答案。

使用Fancybox 2,我可以通过AJAX获得帖子以使用以下配置:

$.fancybox.open({
    type: "ajax",
    ajax: {
        dataType: "html",
        type: "POST",
        data: {
            "foo" : "bar",
            "foo2" : "test"
        }
    },
    href: "url-to-post-to.php"
})