Re: Gzip and Ajax



On Mar 3, 10:11 am, "Álvaro G. Vicario"
<alvaro.NOSPAMTH...@xxxxxxxxxxxxxx> wrote:
slangtr...@xxxxxxxxx escribió:

The problem is that if I put ob_start("ob_gzhandler"); (which you can
 Google if you don't know what I'm talking about) in the script which
 builds the form, presumably it buffers all screen data and gzips it,
 then sends it to the browser with a header saying it's gzipped. It's
 all done then. When the second script is called by Ajax it sends no
 headers, just a single echo(...) containing the screen it's built,
which the Ajax function catches and squirts into the DIV waiting on
the form page. It's that output which needs the buffering, the data
for the form screen is trivial. Any way to do it?

Sorry, I hadn't actually paid attention to the main post. That's not how
HTTP or AJAX work. Every request to the server is independent (even the
pictures linked in <img> tags!) and has its own headers, whether you
write them yourself or they're all generated by the PHP interpreter or
the web server.

It looks like you're trying to fix a problem you don't have. I suggest
you install the Firebug extension for Firefox, enable the Net
panel for your dev site and see by yourself how things run in the
background.

Also: "ob_gzhandler() determines what type of content encoding the
browser will accept and will return its output accordingly."

http://es.php.net/ob_start

--
--http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://bits.demogracia.com
-- Mi web de humor al baño María:http://www.demogracia.com
--

Thanks, Alvaro, that was the key. I have Firebug, but had never
noticed the Net tab before. Looking at it, I see that although the
length of my AJAX data is unknown (represented by a ?), by checking
the headers for that segment I can see that it is actually getting
gzipped. Thanks for the help!

.



Relevant Pages

  • Re: Gzip and Ajax
    ... builds the form, presumably it buffers all screen data and gzips it, ... When the second script is called by Ajax it sends no ... headers, just a single echocontaining the screen it's built, which the Ajax function catches and squirts into the DIV waiting on the form page. ...
    (comp.lang.php)
  • Re: YUI Libraries
    ... scenario where some bonehead decides he wants an "AJAX site" and simply ... Never thought I would see a 3200 line script to load dependent files though. ... What YUILoader appears to be for is loading dependent files and nothing more. ... I don't care to make a test case, but, if anybody is using it then you can possibly tell me how it deals with a case where it retrieves a document via AJAX that has script blocks in it. ...
    (comp.lang.javascript)
  • Re: IFRAME & AJAX ; point me out
    ... Well 'to AJAX or not to AJAX' that is the question I was asking my self. ... Do I realy need AJAX and when I saw a script developed with javascript and that the script created an ActiveX object, ... After being defribillated :-) I thought of remote scripting using an IFRAME, after all I read a lot about how to do this and I tried to give it a shot. ...
    (comp.lang.javascript)
  • Re: [PHP] Closing a connection to browser without exiting the script
    ... I think the Ajax solution that John suggests is the ticket. ... My solution was to print the please wait message to the screen, while accessing the database using an Ajax call. ... I used Perl for my server-side script, but if you prefer PHP you can create a CGI script using PHP and run the same process as your original PHP page. ...
    (php.general)
  • Re: Javascript Library
    ... inserting them in a container element via innerHTML and then proclaiming ... All in the name of having an "Ajax site." ... Last function I posted to attempt to deal with script execution? ... var isIE = false; ...
    (comp.lang.javascript)