posts - 250,  comments - 58,  trackbacks - 5053

Have you ever seen the nice "processing" page on sites like Expedia?  They are all pretty much the same.  Fill out some criteria hit a button and a little animated gif comes up to show you that something is happening in the background.  Granted, it's just for perception.  All hell could be breaking loose on the backend, but as long as a user can see a spiny icon they are in bliss.

I had to do that for a project.  It turns out to be a little harder than I thought.  The basic problem I ran into was that an animated gif will stop animating as soon as the location of the page is changed or the form is submitted.  Here are a few things I tried that failed:

  1. Criteria page has a hidden processing image. On click show the image, then submit. Hide the image on load.
    Result: image stops animating on submit
  2. On click redirect to new page that only has the image, auto submit the the page on load, on submit redirect to result page.
    Result: image stops animating on submit
  3. On click redirect to a new page that only has the image, on load of the page change the location using javascript to the result page (same as #2 but instead of submitting a form, I'm changing the location via javascript).
    Result: image stops animating
  4. On click, redirect to new page with iframe, iframe loads another page with processing image.  On load of frame page redirect to result page.
    Result: image stops animating

So nothing was working.  Finally I found something that did work:

On click, redirect to a new page that contains the processing image and an iframe, the iframe points to a page that does all the processing and returns some html.  Once the processing is complete, put the html into the session and change the location of it's parent back to the result page.  Result page reads the html from the session displays it, then clears it.
Result: Bingo

I don't think this is the best way to do it.  Hopefully some people will read this and clue me in.  It does work though. A friend suggested I look into Ajax some more.  I plan to do that soon, but I just didn't have the time to deal with that before my deadline.

posted on Thursday, March 02, 2006 11:28 AM
Post a new comment about this topic
Title  
Name  
Url

Comments   

Enter the code you see: