我有問題循環瀏覽json。問題循環Json
在下面的代碼中,循環的URL不符合要求,並且警報中的ID始終爲3.有人能告訴我我在做什麼錯嗎?
var urls = ["http://soundcloud.com/disclosuremusic/sets/the-face-ep-1", "http://soundcloud.com/skibsthekid/sets/the-pink-slip", "http://soundcloud.com/disclosuremusic/sets/the-face-ep-1"];
for (var i = 0, url; url = urls[i]; i++) {
console.log(i);
$.getJSON('http://api.soundcloud.com/resolve?url=' + url + '&format=json&consumer_key=' + consumer_key, function(playlist) {
alert(i + playlist.title);
});
}
for(var i = 0,url; url == urls [i]; i ++){ – Gautam3164