Skip to content

Instantly share code, notes, and snippets.

@ashaw
Created August 31, 2012 19:13
Show Gist options
  • Save ashaw/3557638 to your computer and use it in GitHub Desktop.
Save ashaw/3557638 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
<script>
$(document).ready(function() {
$("#submit").click(function() {
var username = $("#username").val();
$.getJSON("http://graph.facebook.com/" +
username + "?callback=?", function(resp) {
if (resp.error) {
$("#fullname").html("That username doesn't exist");
} else {
$("#fullname").html(resp.first_name + " " + resp.last_name);
}
});
});
});
</script>
</head>
<body>
<input type="text" id="username" />
<input type="submit" id="submit" />
<p id="fullname"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment