2013-02-21 82 views
0

有没有办法将facebook feed弹出(发布到墙上)在jQuery对话框中?这是我有的代码,这将有对话框和饲料出现不同的弹出窗口:一种将facebook“feed”弹出到jquery对话框中的方法?

<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> 

建议表示赞赏!

回答

0

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

(给它一个网址,您的站点return_uri,将在iframe的父窗口执行一段JavaScript代码,这将再次关闭对话框什么的。)

虽然,这只会如果工作用户已经登录到Facebook(您可能希望使用FB.getLoginStatus来预先确定) - 因为如果没有,Facebook将重定向到Auth对话框,并且不能以任何类型的框架显示,必须打开它在顶层窗口。