Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
How to use JSONP with userinfo.io API
<!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>
<!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