1

我想知道当有人喜欢帖子或评论时,facebook 如何发送反馈数据。帖子的 id 存储在哪里?在 Hiddenfield 还是其他地方?我想要类似的功能,所以想知道其他人是如何做到的。

4

2 回答 2

0

它不是 HTML 表单,而是 Javascript/AJAX。当您单击该链接时,它会触发一个 Javascript 事件(可能是 onclick),然后该事件会对服务器进行 Ajax 调用以实际传输信息。

于 2012-09-26T02:50:10.090 回答
0

这是 DOM 中的 Like 按钮的样子(根据您在站点中的位置、您喜欢的事物类型等而变化。

<a data-ft="{&quot;tn&quot;:&quot;&gt;&quot;}" title="Like this comment" id=".reactRoot[25].[1][2][1]{commentXXXXXXXXX}..[1]..[1]..[1].[1][1]">Like</a>

.reactRoot该表单是从与类选择器关联的 Javascript 事件发布的。

这是当我在自己的墙上点赞评论时表单 POST 的样子。

for(;;);{
    "__ar": 1,
    "payload": {
        "feedbacktargets": [

        ],
        "comments": [

        ],
        "profiles": [

        ],
        "actions": [
            {
                "entidentifier": "445320668840576",
                "likesentences": {
                    "current": {
                        "text": "You like this.",
                        "ranges": [

                        ],
                        "aggregatedranges": [

                        ]
                    },
                    "alternate": {

                    }
                },
                "hasviewerliked": true,
                "likecount": 1,
                "actorid": 100000879403997,
                "clientid": "1348628151510:2909923504",
                "actiontype": "fa-type:like"
            }
        ],
        "commentlists": [

        ],
        "servertime": 1348628145
    },
    "jsmods": {
        "require": [
            [
                "Arbiter",
                "inform",
                [

                ],
                [
                    "UFI\/LikeActive",
                    445320668840576
                ]
            ]
        ]
    }
}
于 2012-09-26T02:57:53.437 回答