|
Posted by Tyno Gendo on 04/13/07 14:08
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.
>
Just an idea, someone who's done it may know better.
- Have your original PHP store it's "status" information in a Session
variable says $_SESSION["status_data"] which is updates as it runs
- Have a timer on the Javascript side which creates a 2nd Ajax call
to a new getstatus.php, which then reads the status from the session and
sends back to the browser in this 2nd Ajax call.
Not done much Ajax, I am assuming you can make another ajax call whilst
one is currently running??
You might need to send the PHP session id back to the server when you
call getstatus.php, not sure.
Let us no how you do :)
[Back to original message]
|