Hello I have a problem with my website. I'm downloading my content via $.ajax from my php file. (echo "My downloaded content <fb:like .....";)
In my content I have also facebook like buttons etc and the problem is that when I download content via Ajax all of facebook features are hidden (not working). When I had my content without ajax everything worked fine. I have my facebook api script in the bottom of my page.
here is my javascript and html code : http://jsfiddle.net/FWeUT/
and php is just echo.
Facebook renders code-on-page only after its JS includes are loaded. You could probably safely rewrite the Facebook JS include after your AJAX call. Seeing that you're using jQuery, consider something like:
if (typeof (FB) != 'undefined') {
FB.init({ status: true, cookie: true, xfbml: true });
} else {
$.getScript("http://connect.facebook.net/en_US/all.js#xfbml=1", function () {
FB.init({ status: true, cookie: true, xfbml: true });
});
}