CodeIgniter Forums
debugbar is breaking my JSON? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: debugbar is breaking my JSON? (/showthread.php?tid=79077)



debugbar is breaking my JSON? - QuasarTheDragon - 04-17-2021

I'm trying to retrieve data for my calendar but for some reason I get this response
Code:
[{"title":"aaa22","start":"2021-04-01","end":"2021-04-01","id":"4"},{"title":"aaaeeee","start":"2021-03-30","end":"2021-03-30","id":"48"},{"title":"beep boop","start":"2021-03-31","end":"2021-03-31","id":"54"},{"title":"lorem ipsum edit","start":"2021-04-06","end":"2021-04-06","id":"55"}]
<script type="text/javascript"  id="debugbar_loader" data-time="1618658976" src="localhost/myapp/?debugbar"></script><script type="text/javascript"  id="debugbar_dynamic_script"></script><style type="text/css"  id="debugbar_dynamic_style"></style>
I have no idea how the <script> is getting there but it's causing a JSON Parse error on my view file.

Controller:

PHP Code:
    function get_activities()
    {
        
$data['start'] = $this->request->getGet('start');
        
$data['end'] = $this->request->getGet('end');
        
$activities $this->Calendar_model->get_activities($data);
        echo 
json_encode($activities);
    } 



Model:
PHP Code:
  function get_activities($data)
  {
    $builder $this->db->table('calendar');
    $builder->where('start >='$data['start']);
    $builder->where('end <='$data['end']);
    return $builder->get()->getResultArray();
  



RE: debugbar is breaking my JSON? - InsiteFX - 04-17-2021

app/Config/Boot/development.php

CI_DEBUG = false;


RE: debugbar is breaking my JSON? - QuasarTheDragon - 04-17-2021

(04-17-2021, 12:04 PM)InsiteFX Wrote: app/Config/Boot/development.php

CI_DEBUG = false;
Yup, that fixed it. Thanks!