Possible Duplicate:
Sequencing ajax requests
I got an array of artist names. For each artist name i make an ajax json call to a webservice to get songs by this artist.
My question now is: How can i be sure, that all ajax requests are done (either success or fail).
I looked at Deferreds and AjaxManager, but i cant implement it so that it runs (if it's the right method...)
My code looks something like:
$.each(tf.suggestedArtists, function(index, artist){
var url = tf.enBaseUrl + "song/search?api_key=" + tf.apiKey + "&format=json&artist=" + artist.name + "&bucket=id:spotify-WW&bucket=tracks"
$.ajax({
type: "GET",
url: url,
dataType: 'json',
}).done(function( data ) {
//...do some more stuff
It's not possible to do these calls async because of JSON and cross domain issues.