I have the following situation:
jquery:
$(function(){
$('input[type="button"]').click(function(){
$('#result').load('script.php');
});
});
script.php:
<?php
echo "1";
sleep(2);
echo "2";
sleep(2);
echo "3";
?>
Currently the jquery load function will wait for the php script to finish and then display the result into the targeted div...so in this case it will wait 4 seconds and then display 123.
What I'm trying to achieve is to have the jquery load function to return the results separately, live, before the php script finishes. By separately I mean to see in the targeted div 1 then wait for 2 seconds, then see 2, then another 2 seconds and then 3.
Is this possible with my example?