简体   繁体   English

检查Javascript中的Facebook事件订阅是否正常运行

[英]Checking to see if Facebook Event Subscription in Javascript is working

The Ajax below is on a file with a Facebook Like button. 下面的Ajax在带有Facebook Like按钮的文件上。 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. 当单击Facebook Like按钮时,我试图使用下面的Ajax在名为fblike.php的文件上执行一些PHP。 It's not working. 没用 Is there any way I can check to see if FB.Event.subscribe('edge.create', function(response) {}); 有什么办法可以检查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>

?> ?>

Yes, use firebug or the inspection tool in chrome/safari, or even IE Developer toolbar. 是的,使用Chrome / Safari浏览器中的Firebug或检查工具,甚至使用IE Developer工具栏。 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. 导航到NET选项卡,然后查看是否有任何请求发送到'fblike.php',或者将console.log或alert()消息添加到成功和错误回调中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM