javasrcipt asyncronous function
- by Ben
Hi there,
i have a problem understanding how this could/should be solved.
I have two functions. In the first function ( I call it loadData() ) I'm doing an asyncronous request to the server to load some data.
In the second function ( saveData() ) I'm also doing an asyn request to the server to write some data. In the callback of this request I'm callin loadData() to refresh the data.
Now the problem: In the saveData() function I want to wait for loadData() to be finished bevore I show a dialog (like alert('Data saved'))
I guess this is a common problem, but I couldn't find the solution for it (if there is one..)
A solution would be to make the requests syncronous, but the framework I'm using doesn't offer that and I hope there's a better solution..
Thanks to all!