I just started looking into this and require some help to start off

I managed to get a working piece of code to show who are online and offline, and how many viewers.

    $(document).ready(function() {
var members = ['Herpaderpus', 'turtles_head', 'nubstep_rs', 'ardens_fide', 'newending', 'pve_bros', 'rsphilippe', 'PureIsMwaRS', 'smap51', 'iprimal_rs', 'im_mr_bloo', 'MrKnowles100', 'aikohero', 'cowsbelieve'];
var memberData = [];

$.each(members, function(index, member) {
	$.getJSON('https://api.twitch.tv/kraken/users/' + member + '?callback=?', function(d) {
		if(d.status == 404) {}
			// Member does not exist
		else {
			var data = [];
			data[0] = member;
			data[1] = d.display_name;
			$.getJSON('https://api.twitch.tv/kraken/streams/' + data[0] + '?callback=?', function(d) {
			if(d.stream != null) { 
		 	// user isn't offline
			memberData.push(data[0]);
			$( "#player" ).append( "<img src='http://pso-clan.com/twitch/lib/images/online.png'>" + "<a target='_blank' href='http://www.twitch.tv/" + data[0] + "'>" + data[1] + "</a>" + " - Viewers: " + d.stream.viewers + "<br>" );
			  }
			  else {
				  
				  $( "#offline" ).append( "<img src='http://pso-clan.com/twitch/lib/images/offline.png'>" + "<a target='_blank' href='http://www.twitch.tv/" + data[0] + "'>" + data[1] + "</a> - Offline<br>" );
				  
				  }
			})
		}
			
	})
 })

})

Now this is not the most neat and efficient code (in fact, it’s probably horrible), but it works.
There’s two things that I don’t quite understand just yet, which are:
1.The names seem to appear in random order on the webpage. Why would it shuffle?

2.Right now it just appends the text 1 by 1 when it checked a person in the members array, I rather want to make a collection of all current online users first, in the memberData array, and then go into a loop of those to add them all at once (I understand I need to save an array in an array to do that, but that’s not my problem). memberData.push(data[0]); doesn’t seem to work, and any ‘for’ loop doesn’t seem to work either.

Any help is appreciated :slight_smile: