Reputation: 1533
i'm using php to execute a remote url using file_get_contents. if the content retrieved by file_get_contents is not empty then i echo a message saying complete.
However, the remote url can sometimes take a little while to load and because of this the entire php page takes long to load. so i am wondering if there is a way to have a loading please wait message display while the php file_get_contents is doing it's thing. and when it is done to display result as done or error
thanks
Upvotes: 1
Views: 1470
Reputation: 4498
This can be done by js/ajax, not by php directly.
You make your php page load normally without the slow function, then you do an ajax call back to some php script to perform the slow function and return the result to the main page, and while waiting for the result you can display a message like "please wait".
Upvotes: 1