问题描述
当我查看 html 源代码时,我查看了这个 javascript 代码
when i'm looking at the html source, i look this javascript code
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script >
FB.init({
status: true,
cookie: true,
xfbml: true
});
var username= "gun";
var timenow="1311002200";
var securitykey="ef64ba59d2b0f26d69c94fafb3f008e0";
//pls find a way to capture username either session or something else.
FB.Event.subscribe('edge.create', function(response) {
document.getElementById(response).style.visibility = "hidden";
document.getElementById(response+'1').style.visibility = "visible";
//response will be
$.ajax({
type: "POST",
url: "fbreceive.php",
data: "data="+response + "---" + username+ "---"+securitykey+ "---"+timenow,
//this will post to fb receive as url=http://facebookpagewhichwasliked&user=username
cache: false
});
});
</script>
你能告诉我 fbreceive.php 包含什么(某种 facebook api)吗?因为没有那个,我们点赞的 url 就会自动再次不同...
can you tell me the fbreceive.php contains what (somekind of facebook api) ?because without that, the url we did to like is unlike again automatically...
推荐答案
FB.Event.subscribe('edge.create', function(){...}) 是点击 Facebook 点赞按钮时触发的回调.对 fbreceive.php 的 ajax 调用会跟踪哪个登录用户喜欢"网站上的哪些内容以及何时(评论也很有解释性).用户名和时间现在已从用户的会话中捕获并作为 javascript 的一部分包含在内.
FB.Event.subscribe('edge.create', function(){...}) is a callback triggered when the Facebook like button is clicked. The ajax call to fbreceive.php is keeping a track of which logged in user is "liking" which content on the site and when (the comments are also quite explanatory). The username and timenow have been captured from the user's session and included as a part of the javascript.
我想说,这是一个非常好的主意!
It's a really neat idea, I would say!
这篇关于Facebook点赞回调,并发布到目标点赞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!