Facebook - generating fb tag in Jquery - not working

Posted by Gublooo on Stack Overflow See other posts from Stack Overflow or by Gublooo
Published on 2010-05-08T21:34:28Z Indexed on 2010/05/08 21:38 UTC
Read the original article Hit count: 211

Hey guys

Kind of stuck here - I have this functionality on my site where I display 10 user comments along with their photo and when a user clicks on "More" - using Jquery more results are fetched from DB and the results are displayed via string generated in the Jquery method.

This is a shortened version of my Jquery function

$(".more_swipes").live('click',function() {         
var profile_id = 'profile->user_id; ?>';
$.getJSON("/profile/more-swipes", { user_id: profile_id},function(swipes) {
$.each(swipes, function(i,data){
  newcomment="<div>";
  newcomment +="<fb:profile-pic uid='"+data.fb_userid+"' linked='false'/>";
  newcomment +="Name="+data.user_name+"-Comment="+data.comment;
  $("#moreswipes").append(newcomment);                  
});
});
return false;
});

Here as you can see I'm using the tag

<fb:profile-pic uid='"+data.fb_userid+"' linked='false'/>

Now when more results get displayed, the profile pic of the user is not getting displayed - when I look at the source code - this is how the fb tag looks when its generated thru Jquery

<fb:profile-pic uid="222222" linked="false" height="50" width="50">

Whereas the FB tags not generated thru the Jquery code look like

<fb:profile-pic uid="222222" linked="false" height="50" width="50" class="FB_profile_pic <fb_profile_pic_rendered FB_ElementReady" style="width:px;height:50px">
   <img src="http://profile.atk......2025.jpg" alt="User Name" title="User Name" style="width:px;height:50px" class="FB_profile_pic"/>
</fb:profile-pic>

So when I add it as a String in JQuery function - facebook is not identifying it and executing it Any idea how to fix this Thanks a bunch

© Stack Overflow or respective owner

Related posts about fbml

Related posts about facebook-fbml