I am trying to fetch profile picture from facebook. Right now I am getting all information from facebook but unable to get profile pic of the user. Here is my code:
function getFBData () {
FB.api('/me', function(response) {
fbinfo = new Array();
fbinfo[0] = response.id;
fbinfo[1] = response.first_name;
fbinfo[2] = response.last_name;
fbinfo[3] = response.email;
FB.api('/me/picture?type=normal', function (response) {
var im = document.getElementById("profileImage").setAttribute("src", response.data.url);
alert(im);
});
How can I get picture from response of this API.
user_photos
permission via the scope in your FB.login()? – Luke Peterson Jul 30 '14 at 10:18response.data.url
actually contains something before trying to insert it into the DOM. – Luke Peterson Jul 30 '14 at 10:19