Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dynamically added Facebook send button not rendering

I'd like to add a Facebook send button (which is not yet supported with iframes) dynamically to the page after it loads (due to the way the site is constructed, it will be part of an HTML template loaded through AJAX on a user action).

Though I'm importing the FB JavaScript SDK, when I load the new content through AJAX, the marked element is not "transformed" into the FB send button.

I've tried:

<div class="fb-send" data-href="example.com"></div>

and

<fb:send href="example.com"></fb:send>

Any suggestions?

like image 281
dchang Avatar asked Dec 28 '22 12:12

dchang


1 Answers

Whenever you add an FBML element to the dom you should call

FB.XFBML.parse();

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

like image 158
Pete K Avatar answered Feb 03 '23 16:02

Pete K