I had a similar problem that I posted here, JQuery - Looping a .load() inside a 'for' statement and the solution that worked for me, and I think could work for you, since if I read correctly, you want it to do one at a time, was to use a recursive function.
The reason it doesn't work right now is because Ajax performs an asynchronous request, so your code is executed all at once, since your browser doesn't have to wait the request to be finished before moving on to the next one. What you're gonna have to do is force it to wait for it to finish before moving on to it's next task. You do this, as previously said, with a recursive function. Basically your make a function that calls itself only when your request is finally done.
Of course mine used a simple For statement, and not a .each loop. After looking through for a while I found this example of someone wanting to use a recursive function on a .each loop: jQuery recursive iteration over objects
So your code should look like this:
$.each(versions, function(key,value) { recursiveFunction(key, val) });
function recursiveFunction(key, val) {
progressText.html("Downloading Version " + value);
function ajaxUpdate(key,val) {
$.ajax({
url: 'action/' + step + '.update/',
data: 'version=' + value
}).done(function(data) {
console.log(value);
recursiveFunction(key, val);
});
}
}
The code might need a little cleaning up, since I can't for the life of me get used to the stack Overflow code editor, and I might need some more of your code for context on what you're exactly trying to do and how, but in essence it should be something like that. It should work, if you tweak it a bit c: Also read through the links I included here, they should help you understand what I'm trying to convey here.