2

I have a very simple use case. I have an xhr object of ids of facebook users. Now I just want to display the images of the users in the following way.

    xhr.objects.forEach(function (user) {
 $('#userimage').append( '< img src="https://graph.facebook.com/"+user.user_id+"/picture/?type=small"/>');
                                                    });

For some reason this is not working. The images are not being displayed. I have added "https://graph.facebook.com" to allow access. Also images from the local web server are being displayed properly.

Akash Deshpande
  • 2,583
  • 10
  • 41
  • 82

1 Answers1

5

Your string should read

picture?type=small

not

picture/?type=small

So the correct URL is:

"https://graph.facebook.com/"+user.user_id+"/picture?type=small"

See how do I get a facebook users profile image through the fb api for details.

Community
  • 1
  • 1
Gunnar Karlsson
  • 28,350
  • 10
  • 68
  • 71