I am trying to load php file's output in html div. And I have tried it with jQuery's ($('div').load(url_here))
method and it's working fine, but my php file is as below:
<?php
for( $i = 0 ; $i < 10 ; $i++ )
{
echo date('h:i:s').'<br>';
//flush the output buffer
flush();
//send the output buffer
ob_flush();
//sleep here
sleep(1);
} ?>
Now this php file prints a single line every second, but when I load this php in html's div, it takes 10 seconds once the page is loaded and then adds 10 lines all together. I want to load div as php file returns a single line every second. I mean, I want html to respond same as php (i.e. load one line every second, so at 1st second it should load 1st line, at 2nd second it should add 2nd line and so on). So, is it possible? (P.S - I am beginner for this dynamic web)