I have the following piece of code, to get data from IMDB :
for(var i in titles)
{
$.ajax({
url: "http://www.imdbapi.com/?t=" + titles[i],
dataType: 'jsonp',
success: function(data) {
$('body').append('"'+titles[i]+'",');
$.each(data, function(key, val) {
$('body').append('"'+val+'",');
});
$('body').append('<br>');
window.setTimeout(null, 1000);
}
});
}
The code works ok, except for $('body').append('"'+titles[i]+'",'); which alway returns the same title.