how to retrieve and display photos from facebook using javascript? -
i trying retrieve images facebook through javascript api not getting @ actual problem in code.
help appreciated :) in advance.
function testapi() { console.log('welcome! fetching information.... '); fb.api('/me', function (response) { console.log('successful login for: ' + response.name); document.getelementbyid('status').innerhtml = 'thanks logging in, ' + response.name + '!'; fb.api('/me/albums', function (response) { (var = 0; < response.data.length; i++) { var album = response.data[i]; fb.api('/me/' + album.id + '/photos', function (photos) { if (photos && photos.data && photos.data.length) { (var j = 0; j < photos.data.length; j++) { var photo = photos.data[j]; // photo.picture contain link picture var image = document.createelement('img'); image.src = photo.picture; document.body.appendchild(image); } } }); } }); }); }
fb.api('/me/' + album.id + '/photos', function (photos) this making mistake, should be
fb.api(album.id + '/photos', function (photos) also make sure have proper permissions, need user access token user_photos permission.
Comments
Post a Comment