jQuery read AJAX stream incrementally?
This is quite straightforward when outputting text or HTML. Below is an example. (You’ll run into issues if trying to output JSON however, which I’ll tackle further down.) PHP FILE header(‘Content-type: text/html; charset=utf-8’); function output($val) { echo $val; flush(); ob_flush(); usleep(500000); } output(‘Begin… (counting to 10)’); for( $i = 0 ; $i < 10 ; … Read more