Q:

jQuery AJAX Requests in loop Array issue

I've got some AJAX requests in a for loop. The loop steps through an array of URLs and sends requests to all of them, checks for something on each of the pages, and then pages containing the right data will have some data written to an array. The array is a 'global' variable.
The loops works fine. The requests work fine. The array isn't working properly. The done() function for request 1 will push to the array, but the next done() will just overwrite. This consistently happens where done() calls in rapid succession will overwrite sections of the array instead of adding to it. I don't know why this is happening.
I understand the AJAX calls come back in odd orders and timings, but I thought my use of array.push() would get around the need for specifying index's. What's going on?
var globalArray = [];

for (var i = 0; i < URLList.length; i++)
    {
        (function (i) {
            $.ajax(
            {
                url: URLList[i],
                cache: false
            }).done(function(html)
            {
                if (html.indexOf('someString') != -1)
                {
                    globalArray.push(URLList[i]);
                }
            });
        })(i);
    }

So basically, even if the second done() triggers after the first done(), the second done's array.push() will pretend like the array is empty. I don't know why it's not checking each time.

A:

Improvement for @Varrinder 's answer
var URLList = ["url1", "url2", "url3"];
var ajaxResulstArray = [];

makeRequest();

function makeRequest() {

    var urlToRequest = URLList.shift();

    if (urlToRequest != undefined) {
        $.ajax({ 
            url: urlToRequest, cache:false 
        }).done(function(html) {
            if (html.indexOf("someString") != -1) {
                ajaxResulstArray.push(urlToRequest);
            }
        }).always(makeRequest);
    }
}

