Fullcalendar adding events from mysql JSON - adding eventClick returns blank page
I am pulling events into the calendar using JSON and PHP. I am know trying to add eventClicks
or mouseOver
events the the calendar and when I do I get a blank page. My JS knowledge is rather novice so at this point I'm stuck.
Here's my calendar script:
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
editable: false,
events: "json-events.php",
loading: function(bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
}
});
});
Pretty basic, and here's the JSON:
mysql_select_db($databaseDB, $connectItDB);
$sql= "SELECT id, title, description, url, email, Stime, Etime, eventDate, DATE_FORMAT(eventDate, '%Y-%m-%dT%H:%i' ) AS startDate
FROM events
ORDER BY startDate DESC";
$check = mysql_db_query($databaseDB, $sql, $connectItDB) or die(mysql_error());
$events = array();
while ($row = mysql_fetch_assoc($check)) {
$eventArray['id'] = $row['id'];
$eventArray['description'] = $row['description'];
$eventArray['url'] = $row['url'];
$eventArray['email'] = $row['email'];
$eventArray['startTime'] = $row['Stime'];
$eventArray['EndTime'] = $row['Etime'];
$eventArray['title'] = $row['Stime'] . " " . $row['title'];
$eventArray['start'] = $row['startDate'];
$eventsArray['allDay'] = "";
$events[] = $eventArray;
}
echo json_encode($events);
I'm sure it has something to do with the I'm adding the events, any info wi开发者_开发百科ll help that might tighten up the code but my main focus is being able to use eventClick
.
Probably this:
mysql_db_query
should be:
mysql_query
making it like this:
$check = mysql_query($sql) or die(mysql_error());
Make also sure that you put these lines on top of your script to see if there are any errors coming up:
ini_set('display_errors', true);
error_reporting(E_ALL);
精彩评论