When i try to get facebook profile picture using facebook graph api, it was showing that response.data in undefined. here is code to get profile picture
FB.api('/me/picture?width=180&height=180', function (response) {
console.log(response);
document.getElementById('status').innerHTML = "<img src=" +response.data.url+ ">";
});
And the html will be
<div id="status"></div>
here is my graph explorer image
What i'm doing wrong, please can anyone guide mee..
thanks in advance
when i console the response object
It showing like this
error: {…}
code: 1
error_subcode: 1357046
message: "Received Invalid JSON reply."
type: "http"
Please retry with following code:
FB.api( '/me/picture', 'GET', {}, function(response) { document.getElementById('status').innerHTML = "<img src=" +response.data.url+ ">"; } );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.