Loop in function not working
===

Good day **stackoverflow**'ers

I'm getting this little trouble while looping, I always get the same "y" value (5) and it doesn't decreases or increases. What I want is to repeat the ajax call X times [all] and pass the response and the current call number thru an anonymous function. I hope you can help me.

    function _get(pass, all, call) {
    	for (var i = 0; i < all; i++) {
    		$.get(pass, function (data) {
    			call(data, i);
    		});
    	}
    }
    lista = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
    base = "This is 1 line soem";
    _get("sdjadsj", 5, function (data, y) {
    	if (data != "undefined") {
    		newbase = base.replace("soem", data);
    		newbase = newbase.replace("1", lista[y];);
    		console.log(newbase + y);
    	}
    });