triggering functions in series
I have a written a couple of ajax functions that run when a page is loaded to pre-fill certain form elements and text, however I have run into a problem with them in terms of the way they load/display. Because I am using the same function severel times, the scripts sometimes seem to stop or not load properly and move on to the next instance. To get around this I have used "setTimeout" for each instance to give it time to execute before moving on to the next instance, and to a certain extent this works. However, sometimes it still skips an instance, usually the first, even with ridiculously long times upwards of one second.
I have a rough example of the code here:
My question is this: is there a way to check that an instance has completed fully before moving on to the next without having to provide any arbitrary delay times?
//staggered times to load properly
var loadOne = setTimeout(function ()
var loadTwo = setTimeout(function ()
var loadThree = setTimeout(function ()