Monday, 17 October 2016

Returning a json object in codeigniter(flashdata)

There are three things that need to be kept in mind:
  1. The browser may cache the JSON response, so it's a good idea to append a time-stamp to the end of the URL to keep the data coming in fresh. (This is true of the GET method, not necessarily so with POST though).

How to return Json response from controller in Codeigniter

As a side note, you should make sure you are always returning JSON data, so I would remove the exit() message and put a default JSON response at the bottom of the method.