PDA

View Full Version : How to make 2 ajax calls in sequence?



gylim78
06-01-2011, 10:08 AM
1) Script Title:
Dynamic Ajax Content

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:
Hi all

I wish to make 2 ajax calls in succession
something like this ..

ajaxpage('update.php', 'update_status');
ajaxpage('cat_list.php','cat_list');

But I want the 1st one to finish loading then the 2nd call be made.

Basically the 1st ajax call will send some parameters to a php script to update the database. And the 2nd call is used to reload a list to reflect that the changes have been made.

The problem now is that before the 1st call finishes, the 2nd has already started. As a result, the list is showing a non updated list.

Is there a simple way to do this ?

Or could I make my php script call the second javascript ?

Many Thanks