![]() |
Query return empty CSP object when wrapped? - 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: Query return empty CSP object when wrapped? (/showthread.php?tid=80292) |
Query return empty CSP object when wrapped? - blaasvaer - 10-13-2021 If I do this in my controller: PHP Code: return $this->response->setJSON($this->model->find($id)); I properly get the data I want as an object: Code: { But if I wrap it like this: PHP Code: $response = array(); I get this: Code: { Why the empty CSP object all of a sudden? I tried enabling CSP in the Config/App.php but that didn't change a thing ... and to be honest I don't like the 'random' character this has to it. NOTE: And by the way; this editor has serious problems when formatting and previewing posts ... al content gets scrambled and tons of new lines get added. It's basically a nightmare to use. I usually have to use a text editor and copy/paste and reformat everything everytime I make an edit to a post. Someone gonna fix this at some point? Weeeeeeell, that made perfectly sense. I should remove the 'response' part when adding it to an array ... sigh! Change this: PHP Code: $response["data"] = $this->response->setJSON($this->model->find($id)); To this: PHP Code: $response["data"] = $this->model->find($id); RE: Query return empty CSP object when wrapped? - includebeer - 10-13-2021 (10-13-2021, 12:38 AM)blaasvaer Wrote: NOTE: And by the way; this editor has serious problems when formatting and previewing posts ... al content gets scrambled and tons of new lines get added. It's basically a nightmare to use. I usually have to use a text editor and copy/paste and reformat everything everytime I make an edit to a post. Someone gonna fix this at some point? Yeah the editor is not very good. That's why I almost always type in "source code" mode. Click the last icon in the toolbar, or hit ctrl-shift-s to switch between the 2 modes (visual vs. source code) |