所以我使用codeigniter 3。 我问我如何从我的日历中获取开始日期和结束日期以将其插入我的数据库。 这是我的js代码:
CalendarApp.prototype.onSelect = function (start, end, allDay) {
var $this = this;
$this.$modal.modal({
backdrop: 'static'
});
var form = $("<form action='http://localhost/somokos/profile/calendrier/somokos/create_event' enctype='multipart/form-data' method='post' accept-charset='utf-8'></form>");
form.append("<div class='row'></div>");
form.find(".row")
.append("<div class='col-md-6'><div class='form-group'><label class='control-label'>Event Name</label><input class='form-control' placeholder='Insert Event Name' type='text' name='title'/></div></div>")
.append("<div class='col-md-6'><div class='form-group'><label class='control-label'>Category</label><select class='form-control' name='color'></select></div></div>")
.find("select[name='color']")
.append("<option value='bg-danger'>Danger</option>")
.append("<option value='bg-success'>Success</option>")
.append("<option value='bg-purple'>Purple</option>")
.append("<option value='bg-primary'>Primary</option>")
.append("<option value='bg-pink'>Pink</option>")
.append("<option value='bg-info'>Info</option>")
.append("<option value='bg-warning'>Warning</option></div></div>");
$this.$modal.find('.delete-event').hide().end().find('.save-event').show().end().find('.modal-body').empty().prepend(form).end().find('.save-event').unbind('click').click(function () {
form.submit();
});
$this.$modal.find('form').on('submit', function () {
var title = form.find("input[name='title']").val();
var beginning = form.find("input[name='beginning']").val();
var ending = form.find("input[name='ending']").val();
var categoryClass = form.find("select[name='color'] option:checked").val();
if (title !== null && title.length != 0 && beginning != 'beginning' && ending != 'ending') {
$this.$calendarObj.fullCalendar('renderEvent', {
title: title,
start:start,
end: end,
allDay: false,
className: categoryClass
}, true);
$this.$modal.modal('hide');
return ;
}
else{
alert('You have to give a title to your event');
}
return false;
});
$this.$calendarObj.fullCalendar('unselect');
},
答案 0 :(得分:0)
谢谢你们,我明白了。我添加到我的js代码
$('#lab1').val(start);
和我的HTML
<input type='text' id='lab1'/>
再次感谢