Created
May 21, 2011 13:13
-
-
Save pwim/984510 to your computer and use it in GitHub Desktop.
Facebook Graph API
This file contains 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
# javascript | |
$(function() { | |
var ids = $('//[data-fb-id]').map(function(){ | |
return $(this).data("fb-id"); | |
}) | |
$.unique(ids).each(function(){ | |
FB.api('/' + this, function(r){ | |
$("//[data-fb-id='"+ r["id"] + "']").each(function(){ | |
var attr = $(this).data("fb-attr"); | |
$(this).text(r[attr]); | |
}); | |
}) | |
}); | |
}); | |
# html | |
<span data-fb-attr="name" data-fb-id="582880416"></span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment