Last active
August 29, 2015 14:06
-
-
Save vdurmont/5386285b95a45860d65f to your computer and use it in GitHub Desktop.
How to use JSONP with userinfo.io 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>UserInfo.io — JSONP callback</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script type="text/javascript"> | |
function userinfoCallback(data) { | |
console.log("I can now do awesome things with this beautiful data I just received!"); | |
console.dir(data); | |
} | |
</script> | |
<script type="text/javascript" src="https://api.userinfo.io/userinfos?jsonp_callback=userinfoCallback"></script> | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>UserInfo.io — JSONP variable</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script type="text/javascript" src="https://api.userinfo.io/userinfos?jsonp_variable=data"></script> | |
<script type="text/javascript"> | |
console.log("Hey, that's awesome! I got a variable with the data!") | |
console.dir(data); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment