Note that there are some explanatory texts on larger screens.

plurals
  1. POFullcalendar not showing any event (backend Codeigniter)
    text
    copied!<p>This has me driving nuts since i cant seem to find anything thats wrong with my code or json. I already spent many hours trying to solve it and reading allot of answers on StackOverflow aswell.</p> <p>I have the following pieces of code:</p> <p><strong>Jquery</strong></p> <pre><code>$(document).ready(function() { $('#calendar').fullCalendar({ editable: true, events: "/action/json/calender", allDayDefault: false, eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)'); }, loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); } }); }); </code></pre> <p><strong>Controller</strong></p> <pre><code>public function calender() { $this-&gt;load-&gt;model('json_model'); $data['json'] = $this-&gt;json_model-&gt;getCalender(); $this-&gt;load-&gt;view('json/calender', $data); } </code></pre> <p><strong>Model</strong></p> <pre><code>function getCalender() { $sql = "SELECT id, title, start, end, user_id FROM gc_calender"; $result = $this-&gt;db-&gt;query($sql); return $result; } </code></pre> <p><strong>View</strong></p> <pre><code>&lt;?php $jsonevents = array(); foreach($json-&gt;result() as $entry) { $jsonevents[] = array( 'id' =&gt; 1, 'title' =&gt; $entry-&gt;title, 'start' =&gt; $entry-&gt;start, 'end' =&gt; $entry-&gt;end, 'allDay' =&gt; '' ); } echo json_encode($jsonevents); </code></pre> <p><strong>JSON example</strong></p> <pre><code>[{"id":1,"title":"title 1","start":"2013-09-08 00:00:00","end":"2013-09-08 10:00:00","allDay":""},{"id":1,"title":"title 2","start":"2013-09-17 00:00:00","end":"2013-09-17 10:00:00","allDay":""}] </code></pre> <p>What i've already tried:</p> <ul> <li>Hardcode it in Javascript itself</li> <li>PHP header so it's being outputted as json</li> <li>Older version of fullcalender</li> </ul> <p>Here's the fun part.. the demo that comes with the package works for me. However if i point my jquery code to that specific json url i still get no events. The calender itself gets rendered fine.</p> <p>Something more that i tried: Using the demo HTML page with the JSON being served by codeigniter and it works.. Im starting to think there's either a conflict with a different script or maybe i need to load my scrips in the header instead of the footer?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload