for($x=0;$x<100000;$x++) {
echo "hello $x";
}
So, normally, it will finish processing everything first and then print everything at once. Is there a way to just keep printing the message as the command is sent, so that I’ll see a new hello $x appended one by one or do I have to use jQuery/JavaScript?
Update:
I ask because I’m trying to run a long test script and have it show all the results 1 by 1 on the browser so I don’t have to go check the logs and could just visually see the color coded results. I’m trying to make a similar effect to this: http://tools.css3.info/selectors-test/test.html If anyone could provide a short sample of the jQuery (if it has to be done this way), I would appreciate it.
Although it’s possible by controlling the output buffer, I wouldn’t do that, mainly because it will delay the JavaScript DOMReady event.
If you’re looking for a visual effect, you should use JavaScript (but I don’t see any reason for Ajax based on what your question says). It can be accomplished with a simple
setInterval. Considering an initially empty<div id="hello">:I just saw your edit, and now I think you actually should use Ajax! The example you linked to does. Basically, you have to setup a test queue in JavaScript, where each test has an unique URL. Then it’s just a matter of firing one request at a time with Ajax (jQuery and
$.getwould be the easiest way to go). The following assumes an<ul>instead of the div from my previous example, and that the server will respond with a success or failure message for each test: