3

in header

<meta property="fb:admins" content="my id"/> 
<meta property="fb:app_id" content="my api"/>

And in body

 <div id="fb-root"></div>
        <script>(function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1&appId=my api";
            fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>

In html

<div id="facebook">
<div class="fb-comments" data-href="<?= $this->productLink ?>" data-width="470" data-num-posts="10"></div>
    </div>

I find problem-i load my web page with ajax and that facebook code don't work with ajax. How render my facebook comments after ajax? Execute that function?

4

1 回答 1

21

在 ajax 下方添加以下 javascript 代码以显示 facebook 评论插件。

FB.XFBML.parse();

参考:http: //developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/

于 2013-03-22T04:03:41.390 回答