Page 1 of 1

Loading icon or progress bar while Curl loads json

Posted: Sun Sep 17, 2017 12:53 am
by stoggafu
I have been searching for something like this, but am unable to find a good solution. I have a page that has 3 tables. Each table uses CURL to pull json info and fill the tables, one by one. Each table is located in a different php file on the index.php page. The page loads in order of the files, and sometimes can take a while depending on the amount of data it is pulling....I would like to put a loading image or if possible a progress bar over the top of each table while/until they load fully...The only solutions I have been successful with is using JavaScript and a loading image for the whole page....I need each section separate....Here's an example of my structure.

Code: Select all

<?php // index.php
include 'table_1.php'; // loads json into table
include 'table_2.php'; // loads json into table
include 'table_3.php'; // loads json into table
?>

Re: Loading icon or progress bar while Curl loads json

Posted: Sun Sep 17, 2017 6:35 am
by Celauran
I think a JS solution might make the most sense here. Have the server send the structure of the page but without the data. Frontend sends AJAX calls to retrieve the data, displays a spinner until the promise is resolved, then updates the page and hides the spinner.