Check status, if offline move to next

Hey there!

I am designing a website but got stuck on trying to do this.
The idea around is is that we display a stream on top of our page. However to have it streaming most of the time we like to be able to check if streamer is on, and if not move on to next and see if that person is online, and so on until it reached the end or an online streamer. When someone is online i would like to echo code.

This is the code i have so far

function reloadFrame() {
	for (var i=1;i<=14;i++){
	var nm = 'frame' + i;
	var e = document.getElementById(nm).attributes[4].nodeValue;
	e = e.split("/");
	e = e[e.length-2];
	var ur = '' + e;
  		url: ur,
  		dataType: 'jsonp',
  		type: 'get',
  		success: function(data) {
    		if( === null) {
      			//here i would like to add in, that if celplays is online to search if CohhCarnage is online(or someone else) And so on for a couple until there is one online. If online then to                                 display code provided under this frame.
                            //And if next is online the also display embed viewer. and so on.
                echo("")//if is on then just display code for the embed viewer.

Code to echo ->

<iframe src="" frameborder="0" scrolling="no" height="210" width="400" style=" -webkit-box-shadow: 0px 0px 5px 5px rgba(0, 0, 0, 0.75); -moz-box-shadow:0px 0px 5px 5px rgba(0, 0, 0, 0.75); box-shadow:0px 0px 5px 5px rgba(0, 0, 0, 0.75);"></iframe>

Is there any possiblty to do this? Or am i going the wrong way with the code?


You seem to be mixing JS and PHP here. Is that really the code you’re running?

Well, I got partially this code off of this forums aswell, but none really explain me how to check if someone’s online and then check again if someone’s online. If i know how to check if someone is online for the second streamer i might be able to do it myself. However doubt so. Is there anything wrong then with the code?

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