Below is a code to check a ustream account if they are broadcasting live. What I'm trying to do is make it change live on the site if the variable changes. So if the user goes live, it updates the div tag on the site without having the user refresh. How can I do that?
<div id="status" class="status"></div></p>
<script type="text/javascript">
function set_status(status)
{
if (status == "offline")
{
document.getElementById("status").innerHTML = "OFFLINE";
}
else if (status == "live")
{
document.getElementById("status").innerHTML = "<a href='http://www.chamillionaire.com/live.html'><img src='http://www.chamillionaire.com/images/statuslive.gif' border=0 /></a>";
}
else
{
document.getElementById("status").innerHTML = "OFFLINE";
}
}
</script>
<script type="text/javascript" src="http://api.ustream.tv/json/channel/CHANNELNAME/getValueOf/status?key=YOURAPIKEY&callback=set_status">
</script>