make sure you’ve enabled autoincrement for ‘id’ column. Otherwise connector won’t be able to insert new item
On the client side, you either need to load events from the database or add them to the scheduler using addEvent. If you parse event from json (and event with such id does not exists in the database), scheduler won’t be able to save it because it will be trying to perform ‘update’ for the item which not exists in database.
If none of this helps - try enabling the log and check what the error message is
However, I still can’t make it work to load data and save data to mysql.
Particularly I need to save data to my database when users enter data from the lightbox and the calendar will load data from the database to display the events.
Here is my updated code:
<html>
<head>
<title>Home</title>
<link href="http://bit-mp.tp.edu.sg/~m02/codebase/dhtmlxscheduler.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://bit-mp.tp.edu.sg/~m02/codebase/dhtmlxscheduler.js"></script>
</head>
<style type="text/css" media="screen">
html, body{
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
}
</style>
<body>
<div id="scheduler_here" class="dhx_cal_container" style="width:100%; height:100%;">
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button"> </div>
<div class="dhx_cal_next_button"> </div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
</div>
<div class="dhx_cal_header"></div>
<div class="dhx_cal_data"></div>
</div>
<script type="text/javascript" charset="utf-8">
scheduler.load("calendarevent.php");
scheduler.config.api_date="%Y-%m-%d %H:%i";
scheduler.init('scheduler_here', new Date(), "month");
scheduler.addEvent({
id:2,
start_date:"2014-10-25 15:00",
end_date:"2014-10-25 19:00",
text:"New event"
});
var dp = new dataProcessor("http://bit-mp.tp.edu.sg/~m02/codebase/scheduler_connector.php");
dp.init(scheduler);
var events = [
{id:1, text:"meeting", start_date:"2014-10-23 22:37:20",end_date:"2014-10-23 22:45:00"},
];
scheduler.parse("events", "json");//takes the name and format of the data source
</script>
</body>
</html>
var dp = new dataProcessor("http://bit-p.tp.edu.sg/~m02/codebase/scheduler_connector.php");
if http://bit-p.tp.edu.sg is not the same server where your app is hosted, then dataprocessor won’t be able to send updates there. It uses the regular Ajax request which does not work cross-domain.
You need either have processing logic on your server, or have some proxy handler that will receive ajax from dataprocessor, resend it to the remote server and return the remove response. In both cases php should be placed on the same domain where your page is.
Alternatively, you can trace changes in the scheduler and send changes to the server manually, using JSONP or any other approach for cross-domain requests.
require_once('http://bit-mp.tp.edu.sg/~m02/codebase/scheduler_connector.php');
Usually cross-domain includes and requires are disabled in php settings for security reasons stackoverflow.com/questions/2752 … r-with-php
thank you your reply:)
I’m sure the app is under the same server and checked that there is any typo error in the file path for both the files but to no luck.
Would really appreciate your further help!
I’m sure the app is under the same server
It must be not only the same server, but the same domain name as well.
If you are loading page like “localhost/some.html”, while full server name is “bit-mp.tp.edu.sg” it will not allow to load data from such url. Browser checks only that domain of the page and domain of data feed is the same, it doesn’t really care is it the same server or not.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan