Hey guys,
I'm trying to get the open-source version up, but I'm stumbling across some problems.
This is my update function:
function loadEvents() {
$.post("backend_events.php", // use "backend/events" for ASP.NET MVC
{
start: dp.visibleStart().toString(),
end: dp.visibleEnd().toString()
},
function(data) {
alert(data);
dp.events.list = data;
dp.update();
});
}
This is backend_events.php:
<?php
require_once 'includes/_db.inc.php';
$stmt = $db->prepare("SELECT * FROM `events` WHERE NOT ((`end` <= :start) OR (`start` >= :end))");
$stmt->bindParam(':start', $_POST['start']);
$stmt->bindParam(':end', $_POST['end']);
$stmt->execute();
$result = $stmt->fetchAll();
class Event {}
$events = array();
foreach($result as $row) {
$e = new Event();
$e->id = $row['id'];
$e->text = $row['name'];
$e->start = $row['start'];
$e->end = $row['end'];
$events[] = $e;
}
echo json_encode($events);
?>
it returns an array like this:
[
{
"id":"1",
"text":"Calendar Event 1",
"start":"2014-02-25T10:30:00",
"end":"2014-02-25T16:30:00"
}
]
however, it gives me this error when I'm trying to use it:
Uncaught TypeError: Cannot read property 'getTime' of undefined in daypilot-all.min.js:8
loadEvents daypilot-all.min.js:8
init daypilot-all.min.js:8
update daypilot-all.min.js:8
(anonymous function) (index):111
c jquery-latest.js:3048
p.fireWith jquery-latest.js:3160
k jquery-latest.js:8235
r jquery-latest.js:8778
I have no clue how to fix this, i followed this guide: http://www.codeproject.com/Articles/732679/HTML-Event-Calendar-Scheduler?fid=1854358&df=90&mpp=25&noise=3&prof=False&sort=Position&view=Normal&spc=Relaxed&fr=26#xx0xx
with some changes i got the database to work (using PDO). for example I had to change backend_events.php because the data send was using the $_POST method and not the $_GET method.
Would really appriciate if someone could help me.
Sem Wong.