Can I create a <fb: like> button programmatically in javascript?
I am working on a Facebook application (iframe) and should add a box at runtime in Javascript as soon as I know what you like in href (for example: the element will like the changes based on the selection on the page, etc.).
Is there any way to create such a block:
<fb:like href="http://example.com" send="true" action="recommend" width="360" layout="standard" show_faces="true" /> or its HTML5 equivalent:
<div class="fb-like" data-href="http://example.com" data-send="true" data-width="360" data-show-faces="true" data-action="recommend"></div> in javascript / jQuery runtime?
I have already tried using the iframe field, but it does not support send, so that would be my backup choice. The tag works well for me, but I can't figure out how to change its href at runtime.
PS: I turned on the Javascript SDK, registered the session, etc.
Any help appreciated, Gionat Mettifogo
You can use the facebook Javascript setInnerFBML to dynamically set FBML objects on a page.
Note that you must first render the FBML string in the object.
You can read more about this here: https://developers.facebook.com/docs/fbjs/#fbml
and here: http://forum.developers.facebook.net/viewtopic.php?id=20157