views:

233

answers:

3

Hello,

How do I use progress bar with percentage for EVERY AJAX request on the page? I've already asked about loading a whole page with one progress bar here But,now I want to know if its possible to use a separate progressbars for each AJAX request on the same page? Any ideas?

Thanks.

A: 

Impossible again. According from W3C, There are 5 state that you can manage it.

  • 0 UninitializedReadyState
  • 1 OpenReadyState
  • 2 SentReadyState
  • 3 ReceivingReadyState
  • 4 LoadedReadyState

Moreover, web server response only 1 time per 1 request. So you can't send progress status from web server. However, you can get status by send another request like ajax-upload.

Soul_Master
+1  A: 

try these following demos

Vikram
A: 

Having a progress bar with percentage depends very much on your server environment. The %age isn't returned as part of a normal HTTP request process, so you need to simultaneously poll the server to obtain a response about the %age transfer process.

This is what some of the examples above do. Other ones appear just to spoof a %age?

Obviously this needs a server capable of delivering this information. You are also adding to the load by using continual requests to poll the server - if you have multiple progress bars, then you are talking about multiple requests + multiple pollings, which will cause quite an additional load. Particularly as simultaneous HTTP connections are limited in the browser.

You could also investigate COMET type approaches, which do various things by keeping requests alive and feeding data asynchronously that way.

mdja