Results 1 to 2 of 2
  1.    #1  
    The app I'm working on has to perform a series of AJAX GET requests to a web service API, and each is dependent on the previous. For instance, send user & password to get an authorization key, then send the key to get additional info, send key again to get more info...

    If the requests are done asynchronously, how do I wait for the results of the first to be returned before beginning the next? Or should they be done synchronously in series? What's the best way to handle this situation.
  2. #2  
    Quote Originally Posted by haeffb View Post
    If the requests are done asynchronously, how do I wait for the results of the first to be returned before beginning the next?
    Use the onComplete callback.

    It will be called with the results when the request is complete. Then you read the results, and request again. Repeat as needed.

    The Prototype JavaScript framework: API.Prototype API Documentation should have all the relevant information.

Posting Permissions