通过AJAX在Facebook Connect网站中加载Facebook fb:profile-pic [英] Loading Facebook fb:profile-pic via AJAX in Facebook Connect site

查看:166
本文介绍了通过AJAX在Facebook Connect网站中加载Facebook fb:profile-pic的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面加载后,我正在发出AJAX请求以拉下一个HTML块,该HTML块包含代表Facebook用户个人资料图片的标签.我将结果附加到DOM中的某个点,但徽标不会加载,而是我看到的只是默认轮廓.

After a page loads, I'm making an AJAX request to pull down an HTML chunk that contains tags representing a Facebook user profile picture. I append the result to a point in the DOM but the logos don't load, instead all I see is the default silhouette.

这只是我使用jQuery加载HTML块的方式

Here's simply how I'm loading the HTML chunk with jQuery

$.ajax({
  url: "/facebookprofiles"
  success: function(result) {
    $('#profiles').append(result);
  }
});

我要添加的HTML是这样的差异列表:

The HTML that I'm appending is a list of diffs like this:

<div class="status Accepted">
  <fb:profile-pic class="image" facebook-logo="true" linked="true" size="square" uid="1796055648"></fb:profile-pic>
  <p>
    <strong>Corona Kingsly</strong>My Status Update<br/>
    <span style="font-size: 0.8em">52 minutes ago</span>
  </p>           
</div>

有什么想法吗?我假设dom加载后就不会处理fb标签.有什么办法可以做到这一点?我的Firebug控制台没有看到任何异常或错误.

Any ideas? I assume the fb tags are not being processed once the dom is loaded. Is there any way to make that happen? I'm not seeing any exceptions or errors in my Firebug console.

谢谢

推荐答案

首次尝试

不确定这是否有很大帮助,但这是有关Ajax + FBML的文章: http://wiki.developers.facebook.com/index.php/FBJS#Creating_FBML_Elements

Not sure if this helps a lot, but here's an article on Ajax + FBML: http://wiki.developers.facebook.com/index.php/FBJS#Creating_FBML_Elements

特别是,也许您可​​以使用setInnerFBML()方法

In particular, perhaps you can use the setInnerFBML() method

关注

所以我认为init函数可以解析f​​bml.因此,显而易见的问题是,如果在init之后插入fbml,如何获取Facebook的javascript库来重新解析fbml(或者只是解析新的fbml).

So I think the init function parses the fbml. So the obvious question is how do you get facebook's javascript library to re-parse the fbml (or just parse the new fbml) if you insert fbml after init.

该线程可能会有所帮助: http://forum.developers.facebook.com/viewtopic.php?id= 22245

It looks like this thread may help: http://forum.developers.facebook.com/viewtopic.php?id=22245

这似乎是相关的代码,尽管论坛上有更多上下文:

Here's what appears to be the relevant code although there is more context at the forum:

if ( FB.XFBML.Host.parseDomTree )
  setTimeout( FB.XFBML.Host.parseDomTree, 0 );

这篇关于通过AJAX在Facebook Connect网站中加载Facebook fb:profile-pic的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆