Created
February 4, 2012 14:20
-
-
Save brianyang/1738109 to your computer and use it in GitHub Desktop.
fb get faces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
img { height: 30px; width: 30px; padding: 1px;} | |
</style> | |
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script> | |
</head> | |
<body> | |
<div id="fb-root"></div> | |
<script src="//connect.facebook.net/en_US/all.js"></script> | |
<script> | |
FB.init({ | |
appId : '209791332384820', | |
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.getLoginStatus(function(response) { | |
if(response.authResponse) { | |
get_faces(); | |
} | |
}); | |
FB.Event.subscribe('auth.login', function () { | |
get_faces(); | |
}); | |
function get_faces(){ | |
FB.api('/me/friends', function(response) { | |
$.each(response.data, function(index,value) { | |
$('#faces').append('<img src="http://graph.facebook.com/'+value.id+'/picture"/>'); | |
}); | |
}); | |
} | |
</script> | |
<div class="fb-login-button" mode="button" data-show-faces="true"></div> | |
<br /><br /><br /> | |
<div id="faces" style="width:760px"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment