i'm having a problem here, in the success method of AJAX i have a if to see if the Streamer is live or not, if is live it returns "online.png" and if is not it returns "offline.png", my problem is that the returns give "undefined" but if i uncomment the console.log in console i can see "offline.png" or "online.png" on console (but the returns still giving undefined). Someone already pass this problem?? Thanks
function checkOnline(nombre){
try {
$.ajax({
type: 'GET',
url: 'https://api.twitch.tv/kraken/streams/' + nombre,
headers: {
'Client-ID': '
},
success: function(data) {
// console.log(data["stream"]);
if (data["stream"] == null) {
return "offline.png";
break;
// console.log("offline.png");
}else {
return "online.png";
break;
//console.log("online.png");
}
},
error: function(data){
alert("Stream not found!");
}
});
} catch (e) {
alert("Conection error, try later... Monkeys are fixing it");
}
}