Events not showing in fullCalendar
I want to add some Events after the fullCalendar object is create... I'm working with PHP and JavaScript.
I have create fullCalendar object and after i want to add some events.
Here is the PHP code:
function BuildEvents() {
// Showing the calendar
echo '<div id="fCald"></div>';
// Events building
$evJSON = json_encode(array(
array('title' => "Evt.1",
'start' => "2010-12-22",
'url' => "#"),
array('title' => "Evt.2",
'start' => "2011-01-15", 'end' => "2011-01-19",
'url' => "http://yahoo.com/")
));
// Adding Events to object
$fCal = '$("#fCald").fullCalendar("addEventSource", '.$evJSON.')';
//Final showing
echo '<script type="text/javascript">'.
'eval('.$fCal.');'.
'</script>';
}
When PHP function is call, the JSON array is OK, but the events are not showing on the calendar...
I 开发者_如何学Pythonalso test this code:
$fCal = '$("#fCald").fullCalendar("renderEvent", '.$evJSON.', true)';
and this is not working to...
I don't understand how to display events after building the fullCalendar object.
Thanks.
Luc M.
There's an easy/straight forward example in the plugin page:
$(document).ready(function() {
$('#calendar').fullCalendar({
editable: true,
events: "json-events.php",
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();
}
});
});
精彩评论