I'm guessing this should be simple, but I can't for the life of me find out how to do it.
I have an each loop, which runs through a number of products, and runs a function against each of them. This function, amongst other things, updates a table with the product's information. However, I need it to wait until 'runThisFunction()' completes, before moving on to the next product, and running the function again.
For example;
$.each(data.products, function(id, v) {
runThisFunction(v);
});
Inside runThisFunction(), it pulls information about the product from the LocalStorage database, but because it runs so quickly, it moves on to the next product before it's done what it needs to do. I could add a delay, but I don't want to purposely slow it down.
I know this should be simple...