Welcome Guest, Not a member yet? Register   Sign In
error when call JSON response
#2

(This post was last modified: 09-10-2020, 11:18 PM by T.O.M..)

If you want to return JSON from your controller method you should set JSON to response and return it - https://codeigniter.com/user_guide/outgo...the-output

PHP Code:
return $this->response->setJSON($json); 

Besides, variable $json may be an array (or maybe, it should be) - it is converted automatically to JSON.
Reply


Messages In This Thread
error when call JSON response - by mylastof - 09-10-2020, 10:14 AM
RE: error when call JSON response - by T.O.M. - 09-10-2020, 11:15 PM
RE: error when call JSON response - by davodm - 01-31-2021, 01:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB