javasrcipt asyncronous function
Posted
by Ben
on Stack Overflow
See other posts from Stack Overflow
or by Ben
Published on 2010-06-10T10:47:52Z
Indexed on
2010/06/10
10:53 UTC
Read the original article
Hit count: 206
JavaScript
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!
© Stack Overflow or respective owner