PDA

View Full Version : Call a php function after the page loads.



Sasha_Aderolop
July 28th, 2014, 02:31 PM
I'm making a website wher i have a table where quotes (finance) are loaded from a csv file. When i visit the page it takes i while to load the page becauese of the csv files. Is there a way to load that part of the page after everything else has loaded ?

SeijiSensei
July 28th, 2014, 03:49 PM
You could perhaps use an iframe for the data display and have that call a second PHP script to load the data.

Have you considered uploading the csv data into an SQL database like PostgreSQL or MySQL? Retrievals would probably be faster.

Another possibility is to load the csv data once and store it in a session so it is immediately available to all other pages after the initial load. That won't speed up the initial loading, but it might move later pages along.

s.fox
July 30th, 2014, 04:00 PM
As an idea you could call another php script via AJAX once the page loads and have the php script page contents load in a div.

Sasha_Aderolop
August 12th, 2014, 11:30 AM
Thanks all for your help.
I use javascript onLoad function to bring it in after the rest of the page has loaded.
and then call the data into a php array function and then display it.