Forum Moderators: open

Message Too Old, No Replies

Multiple AJAX calls in order

         

Nutter

1:05 pm on Mar 18, 2007 (gmt 0)

10+ Year Member



I'm working on a script that needs to call a PHP script through javascript and then use the results from that script to call another. I know how to run each script independentally, but I don't know how to call the first script and wait until it completes to call the second. And the second has to wait on the first because the first returns a database id that's needed for the second.

Any tips on where to start looking?

penders

9:02 pm on Mar 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When (request1.readyState == 4) {
make request2 ...?
}

Or, make request1 a synchronous (no 'a') request (.open("GET",url,false)) and literally wait for it to complete (freezing the client!?) before making request2 ...?

Nutter

12:59 pm on Mar 23, 2007 (gmt 0)

10+ Year Member



I was making that way more difficult than it needed to be. Calling another function just didn't cross my mind :)