[jQuery] Please wait while executing PHP code
Hello,
I have a small web app written in PHP and using Smarty templates, that
has to do some initial work on the server side using PHP after the
very first login of a user.
So I was thinking to display a "Please wait" message/picture but I am
not very sure what's the best practice for this...
Actually if I understand correctly I should simply use something like
this:
jQuery(function($) {
$("#contentArea").load("runservercode.php");
});
$().ajaxSend(function(r,s){
$("#pleaseWait").show();
});
$().ajaxStop(function(r,s){
$("#pleaseWait").fadeOut("slow");
});
So this is the theory, the problem is that I actually I don't have any
runservercode.php because the code is all integrated in PHP classes
and rely on other classes to be load and so on. So it would be quite
some work to create an independant one file runservercode.php.
So I was thinking their must be another method to do that ? Something
like a please wait message gets displayed with ajax at the very
beginning, then the PHP code is executed and after that the please
wait message is cleared. And all this without requiring to use the
load() function because the PHP would already be in the same file as
the jQuery code.
Thanks for your input
Regards