Created
July 7, 2017 16:33
-
-
Save sandroweb/6b3a05c38fa264a249ad62dbece36ef1 to your computer and use it in GitHub Desktop.
Sample code to load feed of Facebook Public Page or Public Group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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