Created
September 18, 2017 16:16
-
-
Save ashlynnpai/4437db06a7a3ae0b3e471daec9517d76 to your computer and use it in GitHub Desktop.
call to Twitch API
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 getFeed() { | |
$.getJSON('https://wind-bow.glitch.me/twitch-api/streams/freecodecamp?callback=?', function(data) { | |
var isStreaming = document.getElementById("report"); | |
if (data.stream == null) { | |
isStreaming.innerHTML = "Down" | |
} | |
else { | |
var a = document.createElement("a"); | |
var streamStatus = document.createTextNode("Up"); | |
a.appendChild(streamStatus); | |
a.title = "Up"; | |
a.href = data._links.channel; | |
isStreaming.append(a); | |
var getDetails = document.getElementById("details"); | |
getDetails.innerHTML = data.stream.channel.status; | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment