Hi Buda, Having had this issue, and seen other frameworks sorting this out, the quickest and easiest way I have found is to have to global variables (flags) in the page, one for each of the Ajax calls.
The Ajax callback method for each then sets the flag for that call back, then checks if both flags have been set, and if so, calls the function of your choice that will then continue the processing you desire. Because each callback only sets its own flag, but then checks both, it will not matter which order they callbacks are received and processed. pseudo code (untested) var flag_1 = false; var flag_2 = false; function callback_function_1() { // Processing... flag_1 = true; if(flag_1 && flag_2) { // Call final method... finalize() } } function callback_function_2() { // Processing... flag_2 = true; if(flag_1 && flag_2) { // Call final method... finalize() } } function finalize () { // Complete processing here... // If we need to call again, then reset the two flags in here... } Hope that helps. Regards. daff SOFTWARE ENGINEER andrew 'daff' niles | spidertracks | 117a the square po box 5203 | palmerston north 4441 | new zealand P: +64 6 353 3395 | M: +64 21 51 55 48 E: d...@spidertracks.co.nz www.spidertracks.com On 22/11/2010, at 9:40 AM, buda wrote: > I have two calls run asyncronously > I need to wait when they both is comleted and only then do somthing > Two - is an example - they may be N-calls :) > > What is the right method to do it? > Is theere an object somthing AsyncWaitFor(AjaxCall1...AjaxCallN)? > > -- > You received this message because you are subscribed to the Google Groups > "Prototype & script.aculo.us" group. > To post to this group, send email to prototype-scriptacul...@googlegroups.com. > To unsubscribe from this group, send email to > prototype-scriptaculous+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. > -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.