Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a long-running script that eventually outputs a file to be downloaded. What I'm trying to do is show a progress bar for that file.

Basically the logic should be:

  1. Start looping through objects (can be thousands)
  2. Echo a progress report every loop
  3. Flush the buffer for output to show immediately
  4. Use jQuery to check that content and display things accordingly

Problem is as I understand, jQuery's AJAX functions wait for the finished HTTP response (by design) so buffering won't help (as the success functions won't load until I finish completely).

How would I go about doing this? Only answers I've found are way outdated plugins that can't be found anymore.

And no - I don't mean a file upload status bar, but a script load one.

share|improve this question
Take a look at web sockets and server sent events. – Musa 41 mins ago

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.