title: Fullcalendar get events with jquery and PHP
body: <p>I'm using JQuery FullCalendar version 1.5.4 and I want to set the events with JQuery.</p>
  
  <p>I use $.getJSON to call a php file, that retreive my data in my MySQL database.</p>
  
  <p>When I limit my query with limit 0,1  , everything works fine. The event is sucessfully displayed in the calendar. However, when my php return an array of object, I get the error : <code>Uncaught TypeError: Cannot call method 'replace' of null</code> </p>
  
  <p>the JSON data returned by my PHP Page looks like this : </p>
  
  <pre><code>[{"id":1,"title":"Halloween ","start":"2013-02-08 00:00:00","end":"2013-02-08 00:00:00","allDay":true},{"id":2,"title":null,"start":"2013-02-12 00:00:00","end":"2013-02-12 00:00:00","allDay":true},{"id":3,"title":"Sortie Valcartier","start":"2013-02-20 00:00:00","end":"2013-02-20 00:00:00","allDay":true}]
  </code></pre>
  
  <p>The PHP code looks like this :</p>
  
  <pre><code>&lt;?php
  
  //header('content-type: application/json; charset=utf-8');
  
  mysql_connect("localhost","root") or die (" NOPE . [" . mysql_error() . "]");
  mysql_select_db("garderie");
  
  $query = "select a.ActiviteID as ActiviteID,a.nom as Nom , cd.datedujour as Jour from activites a 
            inner join calendrieractivite ca 
            on a.activiteid = ca.activiteid
            inner join calendrierdate cd
            on ca.dateid = cd.dateid
          ";
  $result = mysql_query($query);
  
  $events = array();
  
  $i = 0;
  
  $year = date('Y'); 
  $month = date('m');
  
  while($ligne = mysql_fetch_array($result))
  {
      $id = $ligne["ActiviteID"];
      $nom = $ligne["Nom"];
  
  
      $e = array(
          'id' =&gt; (int)$id,
          'title' =&gt; $nom,            
          'start' =&gt; $ligne["Jour"],//$start,
          'end' =&gt; $ligne["Jour"],
          'allDay' =&gt; true
      );
      $events[$i] = $e;
  
      $i++;        
  }
  
  
  mysql_close();
  
  echo (json_encode($events));
  ?&gt;
  </code></pre>
  
  <p>the jquery code looks like this</p>
  
  <pre><code>...
  $.getJSON('json_events.php', null, function(data){
      $('#calendar').fullCalendar({
          events: data,
  ...
  </code></pre>