问题描述
我想知道是否有可能要更改一个Ajax事件的Facebook的类似按钮的动作。
I am wondering whether it is possible to change the action of a Facebook like button on an Ajax event.
我想做的事:我显示文章的页面加载时。在文章的最后,我有一个按钮,加载通过Ajax的下一篇文章。另外,我有以下的Facebook类似按钮:
What I am trying to do:I display an article when the page was loaded. At the end of the article I have a button which loads the next article via Ajax. Additional I have the following Facebook like button:
<fb:like href="http://www.myurl.com" layout="standard" show-faces="true" action="like" id="fblike" />
当我加载在下一篇文章中,我把文章的新网址通过JavaScript的HREF-attribute(其中正常工作),但是当我点击按钮一样的第一篇文章的URL将被推至Facebook,而不是新的。
When I load the next article I put the new URL of the article into the "href"-attribute via Javascript (which works fine), but when I click on the like button the initial article url will be pushed to facebook, and not the new one.
任何想法?
多谢了。
推荐答案
您可以尝试的iFrame的版本,而不是XFBML版本:
You could try the iFrame version instead the XFBML version:
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
在这里看到更多的相关信息:
See here for more infos:
http://developers.facebook.com/docs/reference/plugins/like
这篇关于改变Facebook的网址类似按钮阿贾克斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!