简体   繁体   English

使用fancybox的AJAX发布不起作用

[英]AJAX post using fancybox doesn't work

my script: 我的脚本:

$("#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' }
});  

in PHP return an empty post. 在PHP中返回一个空的帖子。 Interesting if I make this: 如果我这样做很有趣:

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

works fine, any idea? 工作正常,有什么主意吗?

Old question, but no acceptable answer. 旧问题,但没有可接受的答案。

Using Fancybox 2, I am able to get a post via AJAX to work with the following configuration: 使用Fancybox 2,我可以通过AJAX获得帖子,以使用以下配置:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM