I'm looking for a way to check if there is a Facebook user with a particular ID.
I know that there is an Graph API which can return Facebook user's profile picture for given ID, it works like this:
and I see that if I enter ID that doesn't exists it returns error, however I'm still very new to JavaScript so I don't really know how to "read" that error message.
I'm looking for a way to check if there is a Facebook user with a particular ID.
I know that there is an Graph API which can return Facebook user's profile picture for given ID, it works like this: https://graph.facebook./#USER_ID_HERE#/picture
and I see that if I enter ID that doesn't exists it returns error, however I'm still very new to JavaScript so I don't really know how to "read" that error message.
Share Improve this question edited Feb 8, 2014 at 0:46 Kara 6,22616 gold badges53 silver badges58 bronze badges asked Oct 26, 2013 at 14:09 nch7nch7 1102 silver badges7 bronze badges1 Answer
Reset to default 7Try this code by using jQuery.
var pictureUrl= "https://graph.facebook./" + userId + "/picture";
$.ajax({
url : pictureUrl,
statusCode: {
200: function() {
alert("user exist");
},
404: function() {
alert( "user not exist" );
}
}
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745253039a4618790.html
评论列表(0条)