Welcome Guest, Not a member yet? Register   Sign In
How to load json file in codeigniter… newbie

Hi, everyone…
I want to ask something about how to load json file in codeigniter
But before load the json file, i want to pass some data to json file
Any idea for this??

Thanks before

Here is some code to load json file in jquery event calendar

  eventsjson: 'file.json' //here to load json file

$data = json_decode(file_get_contents('file.json'));

If you use Cjax (http://ellislab.com/forums/viewthread/229077/), can do this to pass data:

  eventsjson: 'ajax.php?calendar/json/var1/var2'

Class Calendar Extends CI_Controller {

  function json($var1, $var2)
    $data = array();
    $data['var1' = $var1;
    $data['var2'] = $var2;
    $data['other_data'] = 'some data';

    return $data; //return a json formatted object


Theme © iAndrew 2016 - Forum software by © MyBB