jQuery catch img
- by Happy
We have a script used for each .item:
$(".item").each(function(){
item_link = "http://...";
block = $('.block', this);
$.get(item_link, function(data) {
var src = $('img.slide', data).attr('src');
block.html(src);
});
});
item_link variable is uniquie for each query.
There can be 100 .item or more.
The problem is - server has limit on connections at the same time, that why some .item get var src, some not.
The best solution is to use just one .get at the same time. I think there should be some counter, if .get is finished - it gives message "I'm finished, you can start" to the next .get and so on.
How to do that?
Thanks.