Hey, So I want to know how I can check if a stream is online and if that stream is online change a html element to say where the stream is online.
Here is what I have JS
$.getJSON("https://api.twitch.tv/kraken/streams/{streamname}?callback=?").done(function(data) {
if(data.stream) {
online();
var element = document.getElementById("twtitchlive");
element.innerHTML = "We are live!"
console.log(data)
}
else {
offline();
}
});
EDIT:
Html element
<li><a><span id="twitchlive"></span>Test</a></li>