I have a SearchController with an action that can execute some long running searches and return a results page. The searches can take anywhere from 1 to 60 seconds. The URL for a search is an HTTP GET request of the form: http://localhost/Search?my=query&is=fancy
The experience I'm looking for is similar to the many travel sites that are out there. I would like to show an intermediate "Loading..." page where, ideally:
- The user can reload the page without restarting the search
- Once the back-end search is finished, the user is redirected to the results
- The experience degrades for browsers with JavaScript disabled
- The back button / browser history should not include this interstitial page.
- In the case of a short search (1 second), it doesn't have a significant impact on either the time to get to the results OR the experience (significantly ugly page flashes, whatever)
Those are nice-to-have's. I'm open to all ideas! Thanks.
You could do it the following way:
An example using jquery:
(edit:)
The controller would be something like:
Consider it pseudo-code: i did not actually test it.