Check whether channel is online or not via js [SOLUTION FOUND]

Thank you for a quick response!
I’m trying to implement this, but there should be an error somewhere in this code. How can I debug/search for it? Maybe you can show me, where it is?)
Screenshot: http://puu.sh/h8IAK/6fa92aad63.png
Code snippet: http://pastebin.com/hMKyM4Md