Facebook的喜欢按钮的jQuery加载不工作 [英] Facebook like button loaded by jquery not working

查看:82
本文介绍了Facebook的喜欢按钮的jQuery加载不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加载news_092612.html的#内容分区到使用jQuery另一页。从#内容一切都加载罚款,除了像按钮Facebook的。下面是我使用的脚本,我相信我应该纳入一个解析函数的地方拿到的按钮来重新加载新#newswrapper。我已经搜索并尝试过,但我打了一堵墙。在此先感谢!

I am trying to load a #content div of news_092612.html into another page using jquery. Everything from #content is loading fine except for the facebook like button. Here is the script I am using, I believe I am supposed to incorporate a parse function somewhere to get the buttons to reload in the new #newswrapper. I've searched and tried, but I'm hitting a wall. Thanks in advance!

 $(document).ready(function(){
$('#newswrapper1').load('news_092612.html #content');

 });

另外这里是我从得到#内容原来的页面。 http://www.spadeballink.com/GALLOWS/news_092612.html

Also here is the original page that I'm getting #content from. http://www.spadeballink.com/GALLOWS/news_092612.html

除了我正在试图加载#内容到其他网页。 http://www.spadeballink.com/GALLOWS/TheGoddamnGallows.html

As well as the other page that I'm trying to load #content to. http://www.spadeballink.com/GALLOWS/TheGoddamnGallows.html

推荐答案

这是因为Facebook的插件是由Facebook的SDK,它包括在特定的消息文件加载,而不是页面你试图加载#内容股利之中。

This is because the Facebook widget is loaded by the Facebook SDK, which is included in the specific news file, but not the page you're trying to load your #content div into.

你可以添加以下code到页面gallows.html页:

Try adding this code into the page gallows.html page:

<script>
  (function(d, s, id) {
   var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
</script>

这篇关于Facebook的喜欢按钮的jQuery加载不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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