I have the following scenario:
At onClick() event 2 javascript functions are called, each calling a AJAX POST request to a different php script. In these 2 php scripts data from 2 different databases are collected in 2 class objects. At the end of each script I’m calling a php function which checks if both php scripts ended successfully (checks a flag stored in $_SESSION). When the condition is met, I’m supposed to have 2 class objects populated with data from the 2 databases, and display them both side-by-side. At least that’s what I’m trying to accomplish.
My problem is the data displayed is only for the ‘last-script-to-finish’.
If you can suggest alternatives methods of how I could accomplish this, or see flaws in my logic please shout as I’m not a php or web developer at base.
TA!
you can do the following using jQuery:
So you know both Ajax requests are ready, then you don’t have to solve this serverside since your calls are clientside. More information about jQuery.when.