CodeIgniter Forums
Not able to disable debug bar - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Not able to disable debug bar (/showthread.php?tid=79115)



Not able to disable debug bar - sfarzoso - 04-22-2021

I'm trying to return a view as json, so looking to other post on this forum I discovered this thread.
So I followed the comment of cyberstunts and tried:

PHP Code:
        if ($this->request->isAJAX()) {
            $output "";

            $this->response->setContentType('Content-Type: application/json');

            foreach ($result[$type 's']['data'] as $item) {
                $output .= view('App\Views\Frontend\Search\item', [
                    'item' => $item
                
]);
            }

            return $this->respond($output);
        

but CodeIgniter didn'd disabled the debug bug even specifying the content type as application/json...
Infact, in the response I get:

PHP Code:
<!-- DEBUG-VIEW START 1 APPPATH/Views/Frontend/Search/item.php --> 

and in the json response this error is raised:

PHP Code:
SyntaxErrorUnexpected token in JSON at position 0 



RE: Not able to disable debug bar - InsiteFX - 04-22-2021

PHP Code:
CI_DEBUG false