Created
July 21, 2015 21:48
-
-
Save pasza01/303273da32bf8f0bc853 to your computer and use it in GitHub Desktop.
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
var xmlhttp = new XMLHttpRequest(); | |
var url = "http://api.twitch.tv/api/channels/lirik"; | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { | |
var myArr = JSON.parse(xmlhttp.responseText); | |
myFunction(myArr); | |
} | |
} | |
xmlhttp.open("GET", url, true); | |
xmlhttp.send(); | |
function myFunction(arr) { | |
var out = 'Name: '+ arr.name +'</br>' +'Game: ' + arr.game | |
+'</br>' +'Status: ' + arr.status+'</br>' +'Partner: ' + arr.partner ; | |
document.getElementById("id01").innerHTML =out; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>Twitch api call</h1> | |
<div id="id01"></div> | |
<script src="/api/apitwitch.js" type="text/javascript"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
....src may vary on index.html