jhazelton1:
My webpage isn't Loading. However, if i moved the $(".datacards").append(html) into the displayResults Function, everything loads fine. I just wanted to Reduce all the calls into 1 string with reduce and then append it once, like in my code below. Except, it's not loading when I have it set up like this. Any help would be appreciated. Thanks.
let streamers = [
"joweed15",
"overwatchleague",
"blizzheroes",
"freecodecamp",
"nl_kripp",
"drdisrespectlive",
"ryuquezacotl",
"queenmico",
"timthetatman",
"thijshs",
"lilypichu",
"arteezy"
];
function getStreamers() {
// var html = "";
var channelsAPI = "https://wind-bow.glitch.me/twitch-api/channels/";
var streamsAPI = "https://wind-bow.glitch.me/twitch-api/streams/";
var html = streamers.reduce(function(str, streamer) {
$.getJSON(channelsAPI + streamer, function(data) {
str += displayResults(
data.display_name,
data.name,
data.logo,
data.status
);
});
}, "");
$(".datacards").append(html)
}
function displayResults(display_name, name, logo, status) {
return ``;${display_name}
${status}
}
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE