Issue Looping Json

I'm having an issue looping through json.

In the below code the looped urls are out of order and the id in the alert is always 3. Can someone tell me what I'm doing wrong here?

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);
    });
}

Answers


$.each(urls,function(key,value) {
        console.log(value);

    $.getJSON('http://api.soundcloud.com/resolve?url=' + value + '&format=json&consumer_key=' + consumer_key, function(playlist) {
        alert(i + playlist.title);
    });
});

Need Your Help

Python Tkinter scrollbar for frame

python tkinter scrollbar frame

My objective is to add a vertical scroll bar to a frame which has several labels in it. The scroll bar should automatically enabled as soon as the labels inside the frame exceed the height of the f...

Windows Metro App : How can I add stuff on my screen which is displayed only when I scroll on it?

windows scroll microsoft-metro options

I have information on my main screen (4 listviews) and it takes all the space. What I want to do is add some fields on the sides (to select options and filters) which will not be displayed by defau...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.