How to display loading page before page with search results displays?
Usually when using any web page that is used to search for huge amount of data, like searching for cheap flights, user is first redirected to a page that shows progress bar e.g. 'Now Searching Multip开发者_Python百科le Travel Sites..', and when search on the server is done, then is redirected to actual search results.
How that is done? Is it some javascript/ajax trick?
Well you can easily set a function or event to trigger when the AJAX is finished loading. So on the submission of a form you can just set the page to display "loading..." then remove that to display the results or whatever once the AJAX is finished loading.
there are a few ways, one way as you suspect can be with javascript to show a div or some element with 'loading...' in it, on clicking a submit / search button. This will show up until the moment that the page refreshes with the page results.
There are lots jquery plugins which are really simple to use and allow customization in terms of the processing message you want to show. Here is one such Jquery plugin.
It is as simple as calling $blockUI() and $unblockUI() from javascript. You can check out the demo here.
精彩评论