Author: Aaron Edwards | Posted on: 6/7/2008 11:08:20 PM | Views : 363

I have a function which needs to wait until an asynchronous function completes.  It looks like this...
// First web service is called only if condition is true
if (someCondition==true)
MyWebServices.performFunction(..., performFunctionComplete, performFunctionFailure);

// now a different web service is called unconditionally
MyWebServices.differentFunction(myControl.value, differentFunctionComplete, differentFunctionFailure);

...
}

function performFunctionComplete(result)
{
myControl.value = result;
}
See the problem? The second web service call passes the value of myControl, but depending on the condition, that control's value may be modified by the first web service call. What's happening now is the second web service is be ...

Go to the complete details ...