I am using jQuery and PHP to save content that the user inputs in a database. While the PHP is doing its thing I want to show a loading GIF image just to show that it is saving their data. I realize that it probably does take that long for it to run the code so i want to be able to show the image for at least 1 second if it takes less time than that
Share
For example, I’m using the following script as a live search form in a database.
The user types some letters and the script search if a student with that name exists in the database:
file index.php
file ajax_search.php
You can use that script to save a form via ajax and display a loader gif while waiting.
The important parts are: