my console.log(url) return the same thing every time but when i console it outside the json call, everything work just fine. why is that and how i can fix it? the for loop is counting before the Json make the call. for example when i console the i inside the Json it returns the number 8, 8 times but if i console the i outside de json but inside the for loop it returns 0 to 7
$(document).ready(function(){
var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx","RobotCaleb","noobs2ninjas"];
for(var i = 0;i<channels.length;i++){
var url='https://api.twitch.tv/kraken/channels/'+channels[i]+'?client_id=pd57d4ktf8rjarn9q3qgtv4owbr5q0';
console.log(url);
$.getJSON(url,function(data){
console.log(url);
});
}});