I have a page that displays 10 different items, each item takes a while to load.
Currently, the page has to wait until all 10 items are loaded fully in order to display the webpage. I was wondering, would it be possible to display each of those items on the web page as soon as they are loaded? without having to wait for the rest to be fully loaded.
An array contains all of the 10 items, and by iterating over it, each item is displayed (note: assume displaying those items i.e. loading them takes a while) This is just a simplified scenario to get the idea across:
<html>
<body>
<?php
$array = array("item1", "item2", "item3", "item4","item5", "item6", "item7", "item8","item9", "item10");
foreach ($array as $value) {
// Here..do calculations (which is time-consuming and must be done using php) before building the HTML for each item/value in the array
echo "<div class='display'>";
echo "<h1>".$value."</h1>";
echo "</div>";
}
?>
</body>
</html>
In other words, would it be possible to display the webpage, and update it with content as soon as it's received?