2013-05-29 37 views

回答

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/

相關問題