admin管理员组文章数量:1416642
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" );
}
}
});
本文标签: Check if Facebook user exists using JavascriptStack Overflow
版权声明:本文标题:Check if Facebook user exists using Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745253038a2649935.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论