I want to show the facebook button as a button. When the user clicks the button, he should make a callback after the user successfully likes this page. Here is my code:
<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-width="200" data-layout="box_count" data-action="like" data-size="large" data-show-faces="false" data-share="false"></div> <div id="fb-root"></div> <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/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <script> window.fbAsyncInit = function() { FB.init({ appId : '510679165797120', xfbml : true, version : 'v2.6' }); FB.Event.subscribe('edge.create', function(response) { console.log('hello'); }); }; </script>
But it does not work. When you click on the button, it shows an error. Can someone please tell me how to solve this problem?
source share