|
Posted by Schraalhans Keukenmeester on 04/13/07 19:58
Marvin Zhang wrote:
> Hi,
>
> I'm not familiar with web programming, but I have a problem here.
>
> I have a page. When a user click one button on it, I will use AJAX to
> request a PHP script which will do a bunch of tasks, asynchronously.
> These tasks might take long time so I want to keep the user informed
> of the progress. The problem is that only the PHP script knows the
> progress, how can the web page gets these information from PHP script?
>
> I'd really appreciated if someone could help me solve this problem.
>
The suggested 2nd AJAX call is by far the most elegant solution I'd say.
From when I never even heard of AJAX I found a 'faked' workaround for
user feedback during a long wait:
I found a script to make animated gifs on the fly, drew a progress bar
with several separately saved frames, and used that to set the frame
delay to a custom value based on a rough guesstimate on the server of
the total execution time of the loop or whatever caused a long delay for
the user.
Of course with JavaScript this could be handled much more gracefully.
Sh.
Navigation:
[Reply to this message]
|