Re: Closing a connection to browser without exiting the script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think the Ajax solution that John suggests is the ticket.

I did something like this for a site that books reservations for various services. But before the booking can occur, the customer has to get info on the various service options, which are returned from a separate database server. This takes time and what the company needed in the meantime was a message saying that the query was being processed, please wait. My solution was to print the please wait message to the screen, while accessing the database using an Ajax call. Since with an Ajax call you are not waiting for a page to load there's no hour glass or clock, etc., and from the user's perspective there's a seamless experience.

I used Perl for my server-side script, but if you prefer PHP you can create a CGI script using PHP and run the same process as your original PHP page. Just put #!/usr/bin/php at the top of the script, before the <?php instruction.


Myron

John Comerford wrote:
You could also use an Ajax call from the main window to start the processing without opening a second window.

HTH,
 John

Ed Lazor wrote:
Here's another idea:



I have a PHP page that displays a message, and then, performs a very
long operation. Note that it displays the message first.
I do not intend to give some feedback to the user when the operation is
done.

I've seen I can use ignore_user_abort() to prevent the user from
stopping the ongoing operation, but that solves only part of my problem. Because as long as the page is not fully loaded, the mouse cursor in the
user's browser is showing a watch.

So ideally, what I would like is to be able to close the connection from
the server-side, but without using the exit() function, so my script
keeps running afterwards.




--

_____________________
Myron Turner
http://www.mturner.org/XML_PullParser/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux