我有了这个代码来处理Facebook的回应:处理Facebook的响应
if (response && !response.error_message) {
alert('Posting completed with Post ID:' + response.post_id);
FB.api('/' + response.post_id, function(response) {
x$().xhr('<?php echo Yii::app()->createUrl('survey/saveSocialMediaPost', array('answer_id'=>$answer->id, 'social_network'=>1)); ?>', {
method: 'POST',
async: true,
meta: response,
});
console.log(response);
});
} else {
alert('Error while posting.');
}
}
正如你所看到的,一个右门柱就是我想要做的是后调用AJAX做一些动作在我的数据库。这里的问题是我不知道如何处理响应。执行console.log(响应)抛出这样的事情:
Object { created_time: "2016-03-05T01:27:27+0000", message: "Prueba de comentarios.", id: "xxxxxx_xxxxx" }
正是我需要得到的是message
。 id用response.post_id解决。
你想实现什么,以及想要从响应保存到DB? – Farside