7

I mean... Let's that we just make an AJAX request and inser the result inside a div#result..

In the backend the script use ob_flush() to send the header but not terminate the request until it's terminated (with exit or ob_flush_end)

The content will be loaded into the #result only when the request terminate (exit or ob_flush_end) or it'll be loaded every time the script send the header by ob_flush?

Update:

I'll use jQuery load() to make the request & PHP to answer it

Flatlin3
  • 1,658
  • 14
  • 26
Thiago Belem
  • 7,732
  • 5
  • 43
  • 64
  • As far as I'm aware, there is no ob_end. There is however, ob_end_flush and ob_end_clean, neither of which will "terminate the request"; they merely turn off output buffering. – bish Jan 29 '10 at 19:01
  • @bish - Thank's.. Corrected :) – Thiago Belem Jan 29 '10 at 19:06

1 Answers1

4

Yes, content will be returned, but the XHR object's readyState will not be set to 4, so if you are relying on that to update your div (which most JS libraries' AJAX auto updaters do), you won't see it automatically.

glomad
  • 5,539
  • 2
  • 24
  • 38
  • 2
    I don't think so. I have a feeling that what you want here is not AJAX but COMET (http://en.wikipedia.org/wiki/Comet_%28programming%29). – glomad Jan 29 '10 at 19:17
  • Then give this a try... http://www.php.net/manual/en/features.connection-handling.php#71172 – glomad Jan 29 '10 at 19:28