This fiddle is not working
The problem is here I assume with the getDATA
function.
var getDATA = function(arr) {
var cb = '?client_id=c292fn290f4pac7cpk4j4t137uk3tn&callback=?';
var url = 'https://api.twitch.tv/kraken/';
var hardCodedJSON = [];
arr.forEach(function(stream) {
var obj = {};
var newUrl = url + 'streams/' + stream + cb;
$.getJSON(newUrl).success(function(data) {
// console.log(data)
var streaming = (data.stream === null) ? false : true;
if (streaming) {
obj.classes = 'success fa fa-thumbs-up';
} else {
obj.classes = 'danger fa fa-thumbs-down';
}
obj.username = stream;
hardCodedJSON.push(data);
console.log(hardCodedJSON);
});
});
console.log(hardCodedJSON);
return hardCodedJSON;
};
This fiddle is working with hardcoded data.
It is really killing me. The concept is so simple yet I'm not getting the data in the function. But when i console logs it out. The Data is there. I am making a very basic mistake. Please check it out.