AJAX Loading Message

phpnutphpnut Junior MemberShared Hoster
How would I go about telling the user their request was loading? For example, if a form was submitted using AJAX, how could I say it was loading, then have it say it was finished when it was finished. With the XMLHttpRequestObject status codes?
My ongoing projects...
www.naturesmagazine.com
www.energyreform.org *new domain*
www.photographyavenue.com
----
You may also remember me as imnewtophp...

Comments

  • NuvoNuvo Forum Leader VPS - Virtual Prince of the Server
    Usually, you'd use a "spinner".
    Basically, it's like the throbber design seen in Firefox, so it's a ring of dots that spins (one dot is lit up while the others are grey).
    You show this so that the user knows there's some activity and doesn't freak out (you could also use a loading message with this).

    With Prototype, something like:
    [html]
    <a href="#" onclick="new Ajax.Updater('updater_div', 'returnthis.php', {asynchronous:true, evalScripts:true, onComplete:function(request){Element.hide('message');}, onLoading:function(request){Element.show('message')}}); return false;">LINK</a>
    [/html]
    I haven't toyed with these two as they were ripped from some Rails generated AJAX, but they seem to work for me.
    PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
    Current project: CMS Object.
    Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
    Release date: NEVER!!!
  • lionsgatelionsgate Member NAT Warrior
    Does that script work? I think there is a error. I'll try myself then i'll let you know.
Sign In or Register to comment.