Skip to content

Instantly share code, notes, and snippets.

@sandroweb
Created July 7, 2017 16:33
Show Gist options
  • Save sandroweb/6b3a05c38fa264a249ad62dbece36ef1 to your computer and use it in GitHub Desktop.
Save sandroweb/6b3a05c38fa264a249ad62dbece36ef1 to your computer and use it in GitHub Desktop.
Sample code to load feed of Facebook Public Page or Public Group
$.ajax({url:"https://graph.facebook.com/{PAGE-ID}/feed?access_token={APP-ID}|{APP-SECRET}&fields=picture,full_picture,message,created_time", success: function (r) {
var html = "",
item;
console.log(r);
for (var i = 0; i < r.data.length; i++) {
item = r.data[i];
html = html + '<div class="item">';
if (item.picture) {
html = html + '<img src="' + item.full_picture + '">';
}
html = html + '<p><strong>' + item.created_time + '</strong>'
html = html + '<br>' + item.message + '</p>'
html = html + '</div>';
}
$('#container').html(html);
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment