I have a function get_forecast() that retrieves weather forecasts for a city, and then runs that function on an array of cities, and then displays all the results on a single page. What I'd like to do is have the display change to show "Fetching forecast for $city" as the script is retrieving each city's data so I can see the progress, instead of just waiting for the page to load and display the final results.
What would I add to
foreach($cities as $city){
get_forecast($city);
}
to make it display "Getting forecast for $city" and then refresh the page showing the next "Getting forecast for $city" and then clearing the last one before showing all the forecasts?
Thanks.