NYCPHP Meetup

NYPHP.org

[nycphp-talk] Processing, please wait logic flow question

Dan Cech dcech at phpwerx.net
Mon Oct 30 22:01:07 EST 2006


Cliff Hirsch wrote:
> Many web sites display a "processing please wait" page after submitting
> an order, request, etc. and then display the final confirmation page
> when it's available.
>  
> I'm confused by how that works. Does the server-side script spit out a
> "processing" page by flushing the output buffer and then redirect when
> the script is completed? Or does the client-side JavaScript display the
> "processing" page while the server script goes about its business?

You can do this a few ways, depending on how involved you want to get.

The simplest is just to use some javascript to replace the content of
the current page with a 'processing....' message while the server does
its business.  This works pretty well but doesn't give the user any
feedback about what's going on.

The more complicated approach is to launch the actual processing script
in the background, the refresh a 'processing...' page until it finishes.

With this method you can show the status of the background task, but it
takes a lot more effort to get it right (eg, using a wrapper script to
allow communication between the 'backend' and 'frontend' scripts.

I use both of these methods with good success, it really depends on the
kind of task you are performing.  That said, there are myriad other ways
to achieve this, and I'm sure everyone on the list has their own favorite.

Dan



More information about the talk mailing list