Skip to content

Instantly share code, notes, and snippets.

@fritsvt
Created January 29, 2019 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fritsvt/d2a07e42929bebd05adc585e354361e7 to your computer and use it in GitHub Desktop.
Save fritsvt/d2a07e42929bebd05adc585e354361e7 to your computer and use it in GitHub Desktop.
jsonp.html
<!DOCTYPE html>
<html>
<body>
<h2>Request With a Callback Function voorbeeld</h2>
<button onclick="clickButton()">Haal token op</button>
<p id="response"></p>
<script>
function clickButton() {
var s = document.createElement("script");
s.src = "https://epic.clow.nl/token?callback=responseReceived";
document.body.appendChild(s);
}
function responseReceived(res) {
document.getElementById("response").innerHTML = JSON.stringify(res);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment