Last active
April 8, 2018 03:33
-
-
Save matchilling/e87cfd817d73368d0fb6 to your computer and use it in GitHub Desktop.
Simple javascript demo for https://api.chucknorris.io. Check the fiddle: https://jsfiddle.net/x94e4md8/
This file contains hidden or 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
function getJoke() { | |
var req = new XMLHttpRequest(); | |
req.onreadystatechange = function() { | |
if (4 == req.readyState && 200 == req.status) { | |
var reponse = JSON.parse(req.responseText); | |
console.log(reponse); | |
} | |
} | |
req.open('GET', 'https://api.chucknorris.io/jokes/random', true); | |
req.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment