I am building an html page which needs to be able to retrieve only the latest comment for a Facebook post. I would like to have it auto refresh and again re-load only the latest comment every 10 seconds. I am imagining that this would be done using the Facebook Graph API, Javascript and possibly an Ajax call? Any guidance would be greatly appreciated.
Assuming you know how to install the Javascript SDK and get an access token...
comments order has 3 (ranked, chronological (oldest first), reverse_chronological (newest first)
then include the limit modifier (to only retrieve one) from there the response should be enough to satisfy your needs
FB.api("/{post-id}/comments?order=reverse_chronological&limit=1", function (response) {
if (response && !response.error) {
console.log(response);
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.