Re: Multithreading in PHP
| From: | Manuel Lemos | Date: | Tue, 17 Mar 2009 20:43:03 +0000 |
| Subject: | Re: Multithreading in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290182@lists.php.net to get a copy of this message | ||
Hello,
on 03/17/2009 10:14 AM Manoj Singh said the following:
> I am creating a page which submits the form through Ajax request & the
> submitted page is sending the mails to n number of users. Now until the mail
> sends or the page process completed the end user has to wait.
>
> Is it possible that server sends the response to the client & then start
> processing so that the client doesn't have to wait for the server response.
You will need to use AJAX/COMET requests. Regular XMLHttpRequest AJAX
requests will not do because when you send the AJAX response your script
exits.
With AJAX/COMET requests you can send several responses to the same
request without exiting the script, so you can show progress report.
Take a look at these articles:
http://www.phpclasses.org/blog/post/58-Responsive-AJAX-applications-with-COMET.html
http://www.phpclasses.org/blog/post/51-PHPClasses-20-Beta-AJAX-XMLHttpRequest-x-IFrame.html
This forms class comes with an AJAX/COMET plug-in that allows you to
show progress of a task running on the server without page reloading in
a single request.
http://www.phpclasses.org/formsgeneration
Here is is a live example script that show progress of a task running on
the server after the form is submitted.
http://www.meta-language.net/forms-examples.html?example=test_ajax_form
--
Regards,
Manuel Lemos
Find and post PHP jobs
http://www.phpclasses.org/jobs/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/