well i m using xmlhttprequest to deal with php.
i have, say abc.php which is called from ajax.
in abc
i have a loop, which loops through the length of php array that consist 300 of strings and in loop values are inserted to the database. I have echoed inside loop after the insertion is successful like echo $i. " of " . count($somearray)." values inserted."

All i want is that in html page from where ajax is called, there is a div..and i want to update div everytime the value are inserted. like this.

1 of 300 values inserted...
2 of 300 value inserted...
and so on until 300th value is inserted.

Now...it shows all the lines...after all the values are inserted.