Ok, below is my code. I’m not using the nameARRAY variable, I can see everything output into the console. Six, it does seem like I should be using the /streams/ endpoint, but, will I still be able to pull all the same information from the /channels/ endpoint or will I have to make a separate API call for it?
var searchTERM = $('#searchTERM');
var nameARRAY =["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck",
"habathcx", "RobotCaleb", "noobs2ninjas"];
$('#searchBTN').click(function() {
console.log(searchTERM.val());
$.ajax({
type: 'GET',
url: 'https://api.twitch.tv/kraken/search/channels/?query=' + searchTERM.val(),
headers: {
'Client-ID' : ''
},
success: function(data){
console.log(data);
$('#content').html(data.channels[0].display_name + ', ' + data.channels[0].views + ', ' +
data.channels[0].status + ', ' + data.channels[0].url);
if(data.channels[0].stream === null){
$('#stream').html('Not Online')
} else if (data.channels[0].stream === undefined) {
$('#stream').html('OffLine')
} else {
$('#stream').html('Online')
}
}
});
});