Server Side Loading Animation

Question

I’m using a plugin on my wordpress website that scrapes some datas from other websites and then returns them updating the database. This plugin runs before every page load using Zend_Http_Client to send the http request to those websites and the page is loaded only when the database has been updated.

I’d like to show a loading animation before this code runs since scraping and updating the database can take a while (10-15 sec) but I can’t find a solution.

I’ve thought about some different options but I’d like to know which is the best and if you could point me in the right direction;

Options:

1) Use output buffering with ob_start and ob_flush/flush before my php code runs

2) Redirect to another page with a php redirect and then redirect back to the page requested when it’s completely loaded

3) Use ajax but since my code runs only on server side I can’t use jQuery

4) use a mu_plugin that runs before my scraper

Thank you in advance !

0
Syonos 4 years 2020-03-03T07:50:07-05:00 0 Answers 59 views 0

Leave an answer

Browse
Browse