I want to append a Facebook like button to a certain div using dynamic URL's. Please take a look at this simple example for dynamic URL: JsFiddle
So now I put the code inside ajax call but it doesn't work: JsFiddle
The weird thing is that when I look at the source with chrome developer I can see the like button with appropriate URL is there. But it doesn't show because dimensions are 0 x 0 ...
Related stackoverflow post: Why is my Facebook Like button broken?
Because the facebook script goes through the DOM to get the like buttons, and you've added these buttons after the fact, you have to tell it to look again. It would appear that FB.XFBML.parse();
would be the key to this.