Codeigniter 3 http response json

2
3396
views

We should use codeigniter output to show response, and it also responsible for caching your web pages, if you use that feature.

This is the simple and bad code, because on client side, you must JSON.parse first.

This is show header as json, so your client side can use the object.

This is a good code, and set header 200, and content as json.

Read this to know more about common http status code.

2 COMMENTS

LEAVE A REPLY

Please enter your name here
Please enter your comment!