I am having a function which is taking user id and calling the FB graph API for cover image, the API call is correct I am getting the cover image url but that url is not getting stored in var timlineimagepath
. I had tried every possible scope for that variable
var timelineimgpath;
function getFBTimelineImgPath(userid) {
var URL = 'https://graph.facebook.com/' + userid + '?fields=cover';
var path = $.ajax({
url: URL,
type: "GET",
dataType: "jsonp",
success: function (parsed_json) {
return (timelineimgpath = parsed_json["cover"]["source"]);
}
}
});
I am calling this function from another function but there the timelineimgpath
is coming UNDEFINED
.