Reputation: 2437
How can I add multiple comments box on single page?
For ajax based website. Where I'm loading next Article at end of the first Article and changing URL using HTML5 History API.
The script: FB.XFBML.parse();
re-renders all Facebook widgets for the current URL set for document
.
Upvotes: 0
Views: 934
Reputation: 2437
I found the solution. Just wrap div.fb-comments
element in any div parent and call FB.XFBML.parse()
with element DOM element.
Example:
HTML:
<article>
...
</article>
<div id="fb_comments_box_123">
<div class="fb-comments" data-href="http://www.example.com/article-story-1"></div>
</div>
JS:
FB.XFBML.parse(document.getElementById('fb_comments_box_123'));
Populate the above HTML to document after Ajax call and on success method call above JavaScript.
Upvotes: 2