How do I create a loading overlay(with loading gif) while php script runs and returns data
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PHP is a server-side language and what you’re looking for is something that interacts with the browser on the clientside.
You’re probably best of using a solution involving AJAX – for example using Jquery:
When the user loads the page, make an AJAX call that runs your script. Show a div that displays your ‘loading’ gif. When the AJAX call finishes, hide the div with your ‘loading’ gif.