My problem is that the <div> with the jQuery progress bar ( dnc_scrubber.html ) isn't loaded until all of the other requests are complete.
  Is there anyway around this? I want to change the content of #tabs-1 to the progress bar, and animate it while dnc_scrubber.php is doing its work.
  The lines.php and progress.php files are used to calculate the percentage of work done by dnc_scrubber.php - which updates the session as it goes along. lines.php and files.php return the session variable.
$('#tabs-1').load('dnc_scrubber.html', function() {
var querystring = 'col=' + col + '&' + makeQS(files);
var lines = 0;
$('#progressbar').progressbar();
$.ajax({
url: 'dnc_scrubber.php',
type: 'POST',
async: true,
data: querystring,
complete: function() {
for (i = 0; i < files.length; i++) {
$('#complete').append('<a href="process/MATCHED - ' + files[i] + '">MATCHED - ' + files[i] + '</a><br />');
$('#complete').append('<a href="process/SCRUBBED - ' + files[i] + '">SCRUBBED - ' + files[i] + '</a><br />');
}
}
});
$.ajax({
url: 'lines.php',
async: true,
dataType: 'json',
complete: function(json) {
lines = json.total;
}
});
function setProgress() {
if (prog < lines) {
prog = getProgress();
$('#progressbar').progressbar('option', 'value', prog);
setTimeout(setProgress(), 1000)
} else {
$('#progressbar').progressbar('option', 'value', 100);
}
}
var prog = getProgress();
setTimeout(setProgress(), 1000);
});
  I have already tried loading the progress bar within the callback function of a .ajax() request with async set to false . The same result happens - the progress bar is not loaded into #tabs-1 until dnc_scrubber.php is complete.
  What can I do?
Comments
Post a Comment