I would like to know if there is any way I can insert some event into the database by FullCalendar
,
I've got the current version and I saw that it has a function that it shows a prompt for me to type the event title, but it's only in js so if I update the page it does not leave the event registered.
How can I do this? Follow the code below
$(document).ready(function() {
var currentLangCode = 'pt-br';
// build the language selector's options
$.each($.fullCalendar.langs, function(langCode) {
$('#lang-selector').append(
$('<option/>')
.attr('value', langCode)
.prop('selected', langCode == currentLangCode)
.text(langCode)
);
});
// rerender the calendar when the selected option changes
$('#lang-selector').on('change', function() {
if (this.value) {
currentLangCode = this.value;
$('#calendar').fullCalendar('destroy');
renderCalendar();
}
});
function renderCalendar() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: Date(),
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Event Title:');
var eventData;
if (title) {
eventData = {
title: title,
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
eventClick: function(event) {
$(this).popover({html:true,title:event.title,placement:'top',container:'body',content: 'vamo ver se vai agora'}).popover();
},
lang: currentLangCode,
buttonIcons: false, // show the prev/next text
weekNumbers: true,
editable: false,
eventLimit: true, // allow "more" link when too many events
events: {
url: 'fullcalendar/demos/php/get-events.php',
},
loading: function(bool) {
$('#loading').toggle(bool);
}
});
}
renderCalendar();
});