wait for all ajax requests to finish