note 87084 deleted from function.flush by danbrown

From: Date: Tue, 18 Nov 2008 22:53:53 +0000
Subject: note 87084 deleted from function.flush by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146678@lists.php.net to get a copy of this message
Note Submitter: Brian Guire ---- Situation: wanted to use a SPAN as a status tracker while my script executed, using javascript. I got the flush part right in PHP but it still wasn't working. Then I tried putting each javascript statement in its own block and that worked. Apparently the browsers buffer javascript blocks and don't refresh the page until the block is tied off. So if you ever want to do something like what I've described, instead of doing this: <?php echo "<script type=\"text/javascript\">\n"; // processing echo "setStatus('Did this...');\n"; // more processing echo "setStatus('Did that...');\n"; // still more processing echo "setStatus('Done');\n</script>\n"; ?> Do this: <?php echo "<script type=\"text/javascript\">setStatus('Did this...');\n</script>\n"; // processing echo "<script type=\"text/javascript\">setStatus('Did that...');\n</script>\n"; // more processing echo "<script type=\"text/javascript\">setStatus('Done');\n</script>\n"; ?>

« previous php.notes (#146678) next »