NetTalk Central

Author Topic: Wait, Hourglass, rotating circle thingy...  (Read 3474 times)

Pauly

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Wait, Hourglass, rotating circle thingy...
« on: October 17, 2012, 12:28:20 AM »
G'day all,

Though this is probably very basic, I'm unable to find it so thought I'd ask here;

You know the little circle thingy that rotates while you're waiting for something to happen in a browser?.. Like the equivilent to the ol' hourglass thingy in a desktop app.

How do I code that while I'm looping through a squillion records... For example... when the user clicks a button?

Thanks
Pauly

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Wait, Hourglass, rotating circle thingy...
« Reply #1 on: October 17, 2012, 01:40:48 AM »
you know how you get really simple questions from newbies that have an obvious answer if only they would read the docs, or get some experience?

Well this is not one of those questions.

The short answer to your question is "you can't". Essentially you are confusing "server side delay" with "client side delay".
The busy graphic appears on the client when the client knows it's about to do something that might take a bit of time. Specifically, where it might be sending a request to the server, and awaiting a response (like a new page of browse records.) the graphic is under the control of the _client_ who makes it appear and disappear.

As you know the web works on a request-response system. So the browser makes a request, gets a (complete) response, then processes that response. (There's no such thing as a partial response). what you have in mind is to send back a partial response ("hey, turn on the busy graphic") then do some processing, then send the response (along with "hey, hide the busy graphic"). Alas, because there are no partial ajax responses, this isn't possible.

If you will be gone a long time, say for a big process, or a big report or something, then a progress bar approach is probably better.

cheers
Bruce





ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Wait, Hourglass, rotating circle thingy...
« Reply #2 on: October 17, 2012, 07:34:54 AM »
I send an iframe out with an animated graphic in it. Then from the long server process, I send out a hidden character often enough to keep the interest of the browser.

HTH
Chris
Real programmers use copy con newapp.exe