开发者

Checking to see if Facebook Event Subscription in Javascript is working

开发者 https://www.devze.com 2023-03-13 16:02 出处:网络
The Ajax below is on a file with a Facebook Like button.The Like button works correctly.I am trying to use the Ajax below to execute some PHP on a file called fblike.php when the Facebook Like button

The Ajax below is on a file with a Facebook Like button. The Like button works correctly. I am trying to use the Ajax below to execute some PHP on a file called fblike.php when the Facebook Like button is clicked. It's not working. Is there any way I can check to see if FB.Event.subscribe('edge.create', function(response) {}); is actually firing?

Thanks in advance,

John

<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script >

FB.Event.subscribe('edge.create', function(response) {
   $.ajax({
   url: "fblike.php", // the url of your php script
   context: document.body,
   success: function(){
      // if you want something to be executed when a result comes back
                      }
         });
});

</script>
</head>

<body&g开发者_C百科t;

?>


Yes, use firebug or the inspection tool in chrome/safari, or even IE Developer toolbar. Navigate to the NET tab, and see if any requests are sent to 'fblike.php', alernatively add console.log or alert() messages to both success, and error callbacks.

0

精彩评论

暂无评论...
验证码 换一张
取 消