I can think of four potential issues:
Some servers (SAPIs) feature internal output buffering, typically to a size of 4Kb. This is because sending "chunks" of this size is generally more efficient than sending many smaller pieces.
Some browsers will read chunks of a certain size (again, typically 4Kb) before rendering them to the document. This again improves performance by not re-rendering the page every time a few bytes happen to show up in the network stream.
Some browsers (particularly older IE, can't remember which version) do not allow access to
responseText
until thereadyState
is4
. Obviously this is a limitation, and it has been removed in newer browsers, but it's still a possible problem.EDIT: Some browsers require you to define
onreadystatechange
after calling.open()
. This is to allow reuse ofXMLHttpRequest
objects. Calling.open
effectively "resets" the object.
Possible solution: Assuming the problem is 1 or 2, rather than 3 or 4, then you can try outputting echo $val.str_repeat(" ",5000);
to try and circumvent the output buffering. Obviously this will bloat your bandwidth, but the result should look the same (because spaces are collapsed in HTML)