I’ve written a simple function to grab an authenticated user’s profile picture and set an <img> to that. While the src attribute is updating properly, the image doesn’t actually change.
function getDefault(){
FB.api('/me', function(response) {
$('#default').val("http://graph.facebook.com/" + response.id + "/picture");
});
alert($('#default').val());
}
…
<img id="default" src="getDefault()"/>
<button onclick="getDefault()">Click to see your profile picture!</button>
The attribute isn’t “value”. It’s “src”. So… it should be like this:
Update?: Also, the Alert should be inside because maybe you won’t get any value outside…