getJSON doesn’t allow you to set headers on a request, which is why I suggested the code in the blog post.
You need to replace jQuery.getJSON with the jQuery.ajax call. You’re calling both right now, and you’re seeing the 400 due to jQuery.getJSON failing. You new code would look like this:
jQuery.ajax({
type: 'GET',
url: 'https://api.twitch.tv/kraken/streams' + tnick,
headers: {
'Client-ID': 'xxx'
},
success: function(c){
if (c.stream == null) {
span.removeClass("online");
} else {
span.addClass("online");
}
}
});