I have a user's email, and I would like to search for them in Facebook using the javascript api.
I know I need something
FB.api('/search', {q: '[email protected]', type: 'user'}, function(response) {
//Handle response
});
But this doesn't seem to work, I don't even get a response.
I have also tried putting it inside and/or after a call to FB.login()
which just fails for some reason.
Any suggestions? Their documentation for how to use this is so vague.
EDIT:
Here is all of the appropriate code:
<div id="fb-root"></div>
<script type="text/javascript" >
FB.init({
appId: 'apikey', //Actual API key removed for obvious reasons
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true // enable OAuth 2.0
});
</script>
<script type="text/javascript" >
FB.login(function (response) {
if (response.authResponse) {
FB.api('/search', {q: '[email protected]', type: 'user'}, function(response) {
{
alert(response);
});
}
else {
alert(response.toString());
}
});
</script>
The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.
The Facebook SDK for JavaScript provides a rich set of client-side functionality that: Enables you to use the Like Button and other Social Plugins on your site. Enables you to use Facebook Login to lower the barrier for people to sign up on your site. Makes it easy to call into Facebook's Graph API.
var urlCall = "/search?q=Bamboo&type=page&access_token=";
FB.api(urlCall, function(response) {
//you code to execute
});
Finally found this after some digging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With