Okay so I have these two badges: http://codepen.io/EagleJow/pen/bVrMZv
One is for a Twitch channel, one is for a Livestream channel. I'd like to know if there's an easy way to update the badges on the page every minute to show the current live status of the channels without reloading the rest of the page.
Here's the javascript for the Twitch one:
/*TWITCH BADGE*/
(function() {
var user_name, twitch_widget;
user_name = "nerdist";
twitch_widget = $("#twitch-widget");
twitch_widget.attr("href","http://twitch.tv/" + user_name + "/embed");
$.getJSON('https://api.twitch.tv/kraken/streams/' + user_name + '?client_id=' + '&callback=?', function(data) {
if (data.stream) {
twitch_widget.html("<span class='online'></span><strong> nerdist</strong></br><span class='live'>Online! Playing: " + data.stream.game + "</span>");
} else {
twitch_widget.html("<span class='offline'></span><strong> nerdist</strong></br><span class='notlive'>Offline</span>");
}
});
})();
Any ideas?