This works for me:
HTML:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
JS:
$.getJSON("https://api.twitch.tv/kraken/streams/illusionaryone?client_id=my_client_id", function(c) {
if (c.stream == null) {
console.log("Offline");
} else {
console.log("Online");
}
});
I believe you may need to include your client_id on the request as well, I didn’t try using your entire script though.