Codeigniter 4 development mode returning extra HTML |
Hi to everyone,
I'm having an issue with Codeigniter 4 in development mode. It is now the second case that, when I send data via Ajax, the code breaks in development mode since, aside from the JSON string I need, I also get some code from the debugger like the one below: <script type="text/javascript" id="debugbar_loader" data-time="1604332610" src="http://localhost/index.php?debugbar"></script><script type="text/javascript" id="debugbar_dynamic_script"></script><style type="text/css" id="debugbar_dynamic_style"></style> To make sure everything runs smoothly I always need to switch back to production mode. Anyone knows how to solve this problem? Thanks
You could set the environment in your .htaccess then just remark out the one you do not want to use.
Code: SetEnv CI_ENVIRONMENT development I think I saw in the forum here a way of doing it in the index.php not sure where it is at. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I had a similar problem where the debugbar code was injected in my form data because I was editing an article containing html example.
It is already fixed in the develop branch. So I guess it will be included in the next release: https://github.com/codeigniter4/CodeIgniter4/pull/3804
It is not necessary to switch to production environment. You can disable toolbar in development mode - just disable CI_DEBUG.
In "/app/Config/Boot/development.php" change PHP Code: defined('CI_DEBUG') || define('CI_DEBUG', true); PHP Code: defined('CI_DEBUG') || define('CI_DEBUG', false);
You can also comment the toolbar in the Filters configuration file
PHP Code: /** https://github.com/codeigniter4/CodeIgni...rs.php#L36 (11-03-2020, 06:46 AM)T.O.M. Wrote: It is not necessary to switch to production environment. You can disable toolbar in development mode - just disable CI_DEBUG.Thanks for the tip. But by doing so will I still get whatever errors the development mode usually displays? (11-04-2020, 03:46 PM)includebeer Wrote: You can also comment the toolbar in the Filters configuration file Thanks for the tip. But by doing so will I still get whatever errors the development mode usually displays?
hi AndreaL
you can add exit or die after ajax response end . even if debugger is on this worke. |
Welcome Guest, Not a member yet? Register Sign In |