我有一个包含类似按钮的弹出窗口。如果人们喜欢它,它将永远消失。我该怎么检查?谢谢你的帮助。
答案 0 :(得分:2)
请尝试此代码。
<fb:like href="https://www.facebook.com/your.page" show_faces="false" layout="button_count" width="50" action="like" colorscheme="light" font="trebuchet ms"></fb:like>
<div id="fb-root"></div>
<script type="text/javascript">
<!--
window.fbAsyncInit = function() {
// Don't use my app id, use your own or it won't work!
FB.init({appId: '576586756757658765', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('edge.create', function(href, widget) {
// Do something, e.g. track the click on the "Like" button here
jQuery(document).ready(function(){
$.ajax({
url: 'http://www.yourdomain.com/update_fblike',
success: function(data) {
if(data == "1"){
window.location.href = '/thankyou';
} }
});
});
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
//-->
</script>
更多信息 - http://www.saschakimmel.com/2010/05/how-to-capture-clicks-on-the-facebook-like-button/