将facebook“feed”弹出到jquery对话框中的方法?

时间:2013-02-21 21:04:31

标签: jquery facebook

有没有办法在jquery对话框中弹出facebook feed(发布到你的墙上)?这是我的代码,它会将对话框和Feed作为不同的弹出窗口出现:

<script>
$(function() {
  $( "#dialog-modal" ).dialog({autoOpen: false, resizable: false, draggable: false, height: 250, width: 500, modal: true, dialogCLass: 'main-dialog-class'});

  $( "#opener" ).click(function() {
                       $( "#dialog-modal" ).dialog( "open" );

                       $.getJSON(
                                 "/like_artist.php", // The server URL
                                 { artist_id : $(this).data('artist_id') }, // Data you want to pass to the server.
                                 function(json) {

                                    var text = '';
                                    text = 'You want ' +  json[1] + ' to play a show in your town!  Increase the chances that ' + json[1] + ' comes through your area on tour by alerting your friends!';
                                    $('#dialog-modal').text(text);

                                       FB.ui({
                                       method: 'feed'
                                       });

                                    alert(json[1]);
                                 }// The function to call on completion.
                                 );


        });

  });
</script>

建议赞赏!

1 个答案:

答案 0 :(得分:0)

如果您在jQuery对话框中的iframe中打开它,可以在“假弹出窗口”中按URL调用Feed dialog

(在您的网站上为其return_uri添加一个网址,该网址将在iframe的父窗口中执行一段JavaScript代码,这将再次关闭对话框。)

虽然,这只有在用户已登录Facebook时才有效(您可能希望事先使用FB.getLoginStatus确定) - 因为如果没有,Facebook将重定向到Auth对话框,那可以不能在任何框架中显示,必须在顶层窗口打开。