Hi guys i am using a Jquery plugin for displaying events in calendar and i can see the plugin calendar on my view file just the problem is that i can not create valid json format file for the plugin
This is the format given in the plugin demo page
<?php
header('Content-type: text/json');
echo '[';
$separator = "";
$days = 16;
echo ' { "date": "1314579600000", "type": "meeting", "title": "Test Last Year" },';
echo ' { "date": "1377738000000", "type": "meeting", "title": "Test Next Year"},';
for ($i = 1 ; $i < $days; $i= 1 + $i * 2) {
echo $separator;
$initTime = (intval(microtime(true))*1000) + (86400000 * ($i-($days/2)));
echo ' { "date": "'; echo $initTime; echo '", "type": "meeting", "title": "Project '; echo $i; echo ' meeting", },';
echo ' { "date": "'; echo $initTime+3600000; echo '", "type": "demo", "title": "Project '; echo $i; echo ' demo" },';
$separator = ",";
}
echo ']';
?>
What should be my controller code to display the data. I tried the format in the answer below but it still doesnt display the data properly.
I think something is wrong in the json format i am receiving on frontend. First image is my localhost where i am receiving data and the second one is plugin demo and array format is a bit different i guess and thats the problem

