Changing image based on whether a channel is live or not

I am trying to create a simple json call coupled with an if function to display whether a channel is live or not. I am not a very good developer, but I am trying to make it work for one stream for one site. If someone could point out where my error is, that would be much appreciated. Thank you!

<script src=""></script>
	$.getjson('', function(channel) {

		if (channel["stream"] == "null") { 
		document.write("<img src='/grafx/offline.jpg'>");

		} else {
		document.write("<img src='/grafx/online.jpg'>");
<script src=""></script>
<script src=""></script>
<img data-twitch-channel="legacyobserver" data-online-image="/grafx/online.jpg" data-offline-image="/grafx/offline.jpg">

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.