我使用的是Frontier Jquery Calendar。此日历用于创建事件/议程。现在我想当用户创建事件从日历,然后这些事件存储在数据库中。我不知道该怎么做。有谁能给我指路吗?谢谢,
发布于 2011-08-24 14:52:01
我没有从日历的屏幕截图或文档中看到任何输入函数,所以我认为您需要:
因为问题很简单,所以我会给你一个简单的答案:http://teamtutorials.com/web-development-tutorials/php-tutorials/inserting-data-into-a-mysql-database-using-php
如果您特别想使用漂亮的ajax、漂亮的json和漂亮的css与漂亮的日历进行良好的集成,那么您必须将其分解为更具体的问题,因为您可以编写几本关于这些主题的书籍。
发布于 2015-12-30 19:49:12
如果只想使用php插入数据,可以在其add event表单上使用表单,并使用post方法将数据发送到php文件,然后在php文件中,可以使用php轻松地将post数据插入到数据库中。
但是,如果您想在甚至不重新加载页面的情况下添加数据,您可以在jquery-frontier-cal-1.3.2.js(或您使用的任何版本的插件文件)的this.addAgendaItem函数中使用ajax调用,如下所示:
this.addAgendaItem = function(calId,title,startDate,endDate,allDay,data,displayProp){
if(calId != null && title != null && startDate != null && endDate != null && allDay != null){
// make sure start date comes before end date
if(DateUtil.secondsDifferenceDirection(startDate,endDate) < 0){
alert("Sorry, you can't create an event that ends before it starts");
return;
}
$.ajax({
type: 'POST',
url: "/*your php file path*/ ",
async: false,
data: { /*Send data to using ajax*/ },
success: function (data) {
//handle on success
},
error: function (xhr, textStatus, errorThrown) {
//handle on error
}
});
calId = stripNumberSign(calId);
var hashData = new Hashtable();
if(data != null){
for(var key in data){
hashData.put(key,data[key]);
}
}
var agi = new CalendarAgendaItem(title,startDate,endDate,allDay,hashData);
if(displayProp != null){
if(displayProp.backgroundColor != null){
agi.setBackgroundColor(displayProp.backgroundColor);
}
if(displayProp.foregroundColor != null){
agi.setForegroundColor(displayProp.foregroundColor);
}
}
var calObj = myCalendars.get(calId);
calObj.addAgendaItem(agi);
}
};您可以随心所欲地处理此ajax调用。
https://stackoverflow.com/questions/7171274
复制相似问题