CodeIgniter Forums
Output compression and AJAX - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Output compression and AJAX (/showthread.php?tid=19527)



Output compression and AJAX - El Forum - 06-10-2009

[eluser]EEssam[/eluser]
Hello,

I have some functions that output somethings like 'YES' no 'NO' via echo just to inform jQuery about the AJAX request result but when I'm activating CI compression via config it's not working.

What are the suggested solutions?

Thanks.


Output compression and AJAX - El Forum - 06-10-2009

[eluser]Dam1an[/eluser]
Remove the echo statements Tongue
The config file clearly states you can't echo any output

Quote:VERY IMPORTANT: If you are getting a blank page when compression is enabled it
means you are prematurely outputting something to your browser. It could
even be a line of whitespace at the end of one of your scripts. For
compression to work, nothing can be sent before the output buffer is called
by the output class. Do not "echo" any values with compression enabled.

You shouldn't really echo anything anywhere other then in the view if you're doing pure MVC Tongue


Output compression and AJAX - El Forum - 06-10-2009

[eluser]TheFuzzy0ne[/eluser]
Try:
Code:
$this->output->set_output('YES');



Output compression and AJAX - El Forum - 06-11-2009

[eluser]EEssam[/eluser]
[quote author="TheFuzzy0ne" date="1244662501"]Try:
Code:
$this->output->set_output('YES');
[/quote]Awesome, thanks.