Fullcalendar PHP mysql JSON
大家好,我现在正在开发一个带有计划模块的应用程序 我正在使用Fullcalendar JS构建plannig日历 我找到了这个密码Fullcalendar PHP mysql JSON,php,mysql,json,Php,Mysql,Json,大家好,我现在正在开发一个带有计划模块的应用程序 我正在使用Fullcalendar JS构建plannig日历 我找到了这个密码 initCalendar: function () { if (!jQuery().fullCalendar) { return; } var date = new Date(); var d = date.getDate();
initCalendar: function () {
if (!jQuery().fullCalendar) {
return;
}
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var h = {};
if ($('#calendar').width() <= 400) {
$('#calendar').addClass("mobile");
h = {
left: 'title, prev, next',
center: '',
right: 'today,month,agendaWeek,agendaDay'
};
} else {
$('#calendar').removeClass("mobile");
if (App.isRTL()) {
h = {
right: 'title',
center: '',
left: 'prev,next,today,month,agendaWeek,agendaDay'
};
} else {
h = {
left: 'title',
center: '',
right: 'prev,next,today,month,agendaWeek,agendaDay'
};
}
}
$('#calendar').fullCalendar('destroy'); // destroy the calendar
$('#calendar').fullCalendar({ //re-initialize the calendar
disableDragging: false,
header: h,
editable: true,
events: [{
title: 'All Day Event',
start: new Date(y, m, 1),
backgroundColor: App.getLayoutColorCode('yellow')
}, {
title: 'Long Event',
start: new Date(y, m, d - 5),
end: new Date(y, m, d - 2),
backgroundColor: App.getLayoutColorCode('green')
}, {
title: 'Repeating Event',
start: new Date(y, m, d - 3, 16, 0),
allDay: false,
backgroundColor: App.getLayoutColorCode('red')
}, {
title: 'Repeating Event',
start: new Date(y, m, d + 4, 16, 0),
allDay: false,
backgroundColor: App.getLayoutColorCode('green')
}, {
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false,
}, {
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
backgroundColor: App.getLayoutColorCode('grey'),
allDay: false,
}, {
title: 'Birthday Party',
start: new Date(y, m, d + 1, 19, 0),
end: new Date(y, m, d + 1, 22, 30),
backgroundColor: App.getLayoutColorCode('purple'),
allDay: false,
}, {
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
backgroundColor: App.getLayoutColorCode('yellow'),
url: 'http://google.com/',
}
]
});
},
initCalendar:function(){
如果(!jQuery().fullCalendar){
返回;
}
变量日期=新日期();
var d=date.getDate();
var m=date.getMonth();
var y=date.getFullYear();
var h={};
如果($(“#日历”).width()
有谁能帮助我如何将fullcalnder的代码从静态值更改为从php重新运行的JSON?只需将php脚本的URL传递给Events参数而不是Events数组:
$('#calendar').fullCalendar({ //re-initialize the calendar
disableDragging: false,
header: h,
editable: true,
events: "/url/to/your/PHP/Script.php"
});
更多信息:您想通过AJAX获取JSON数据吗?是@Rik_s i这是我的问题
$('#calendar').fullCalendar({ //re-initialize the calendar
disableDragging: false,
header: h,
editable: true,
events: "/url/to/your/PHP/Script.php"
});