[Javascript] Question - Page Load Feedback
Mike Dougherty
mdougherty at pbp.com
Wed Jul 20 10:08:04 CDT 2005
I'm assuming you're using an xmlhttp call - so when you start the call, you could "blank" the
section where content goes and put a message there saying "loading content..." which is then
overwritten with actual data by the callback function. (you could additionally change the user's
cursor to the recognized "wait" cursor in case they're looking only at the pointer)
That solves the problem of indicating that you're busy working - but people will still get annoyed
if they're suffering that load time more than once. (though I had very fast loading myself)
Maybe you could employ caching. If the data is relatively static and can tolerate a few hours of
ageing, you could do a server-side cache: if the data is not in the cache; load from the DB but
before serving the request, store the results. Next time that menu item is requested, serve the
cached content. If your refresh interval were 24 hours, and you have 50 hits per hour - that's
1199 customers that benefit from the wait-time incurred by the first user's request. It also
takes the same number of requests off the DB (which leaves it available for more dynamic requests)
If this content is published in real time, maybe you can only tolerate a 6 hour (or one hour)
interval - but there's still a considerable savings in using a cache.
Another cache would be to store the xmlhttp results in the page so the user can return to a
selection without having to re-request the content from the server. Building a lazy cache
mechanism using javascript/DOM your client's experience during "comparison" style browsing will
improve with each revisited link. ("it seemed slow the first time, but then when I click it again
it's really fast") This method of cache can be combined with the server-side method to further
reduce the amount of "round-trip" traffic generated by your page.
The menu at pgiproducts.com uses this client-side caching. It was originally designed to support
an infinitely branching tree of menu items. Rather than dump the entire tree on every page load,
only the first level nodes are retrieved. Upon hover/click, the submenu is retrieved. If you
collapse a node, expand another node, then re-expand the first node - you'll be using cached
contents rather than making another across-the-wire request. It's overkill for a two-level menu,
but it was built before marketing decided how to use the tools we provided. (and currently it's
not working outside of IE, which as been fixed on the development server but not yet approved for
publishing)
On Wed, 20 Jul 2005 10:07:31 -0400
"Harvey A. Ramer" <harvey.ramer at designdelineations.com> wrote:
> I designed a web site does not provide feedback after a user clicks a link
> that queries the db. The result is that the user wonders if anything is
> happening. What is the simplest way I can approach this project using
> Javascript? I'm not asking for a complete script, just how to research and
> develop a solution. The URL is
> http://67.15.98.86/tourism/lodging-dining/lodgingbandb/ and if you choose
> another option under lodging you will see what I mean.
>
> My initial thought is to provide a boolean variable from PHP for Javascript
> to use as an event. When the boolean is on, the event triggers and an
> animated gif appears. Is this the best way?
>
> Thanks
>
> Harvey Ramer
>
>
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
> __________________________________________________________
> This message was scanned by ATX
> 10:08:00 AM ET - 7/20/2005
More information about the Javascript
mailing list