This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
All of the code in the fetchId function after the call makePrototypeAjaxCall executes immediately, before the Ajax request has a chance to finish. The alert seems to fix things because the delay caused by the alert allows the request to complete.
You can't do anything that relies upon the completion of the request before the request completes. That's what the onComplete callback is for.
The fix is to move anything that needs to wait until the request is complete into the onComplete handler or to code that is called from that handler.
Your problem was created when you put code that needs to wait until the request finishes in the function that kicked off the request. Any such code needs to be moved. [ November 02, 2007: Message edited by: Bear Bibeault ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com