Since all the other answers concern only the image or text of the placeholder, or just pretending it, here is how you could do it (just a description, no code), but the only difficult part is to determine what part of the work is really done):
Edit the php script that you call through $.ajax to calculate the percentage of work done - how you do it very much depends on what the script is doing and, as such, can be extremely simple (for example, when you just iterate over an array things to process, each of which takes about the same time) or extremely difficult (for example, when most of the time is spent in one single non-repeating library call or built-in function). Store this percentage in the session variable:
$_SESSION["PERCENTAGE_DONE"] = $my_calculated_percentage;
Obviously, you want to update this variable as often as possible and reasonably.
Now create another php script that just prints this value (plain text is enough for this example, but you can also use json or xml or some other format you like):
//initialize session, set headers etc. before this echo $_SESSION["PERCENTAGE_DONE"]
For the javascript part, create another function that calls a new php script via ajax, reads the return value and draws / updates a progress bar (for the part of the drawing, you can take JustinJohns as a starting point). Now, after making the main call to $.ajax , use this function with setTimeout to request the server several times until the task is completed.
l4mpi source share