I have an AJAX call to a PHP function that takes a long time to run. Luckily there are several stages to the function where it makes sense to update the user that progress has been made. For example:
Connecting...
Retrieving data...
Sorting data...
Done!
Right now I have it set up so that a div gets updated only when the final data is sorted and presented back to the user.
I need an example of how I can have partial results or status updates sent back to the div at each stage. You can just use sleep() to simulate a long query, no real database activity is needed.