4

I have a very large file which takes about 5 minutes to load. Its strictly an admin script, however I am currently building a UI for the admin to interact with. I want this script to run within the UI via AJAX. The php script currently has:

@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
ob_implicit_flush(1);

So it progressively outputs through the browser.

However my AJAX call (using jQuery) looks like this:

$.ajax({
  url: "theURL",
  success: function(data){
    $(".content").html(data);
  }
});

And it only outputs once the script has finished running. How can I force AJAX to use the progressive output?

rickyduck
  • 4,030
  • 14
  • 58
  • 93

1 Answers1

0

I think that you will need to use a Web Worker (JavaScript running in the background), for example:

w = new Worker("demo.js");

where demo.js is the JavaScript in background.

Please, take a look: http://www.w3schools.com/html/html5_webworkers.asp