I have the problem: hen i refetch the events from fullcalendar after i did the ajax request for inserting the event, he executes the ajax request multiple times. So the same event is twice or more in the database. Why that? Thanks!
dayClick: function(date, jsEvent, view) {
....
//alert(date.format());
$('#btnYesNew').click(function(){
var startTimeParam = 'startTime=' + date.format() + "%20" + $('#startTime').val();
var endTimeParam = 'endTime=' + date.format() + "%20" + $('#endTime').val();
var purposeParam = 'purpose='+ $('#zweck').val();
var carIdParam = 'carId=' + $('#auto').val();
var departmentIdParam = 'departmentId=' + $('#abteilung').val();
if (view.name != 'month'){
startTimeParam = 'startTime=' + date.format('YYYY-MM-DD') + "%20" + $('#startTime').val();
endTimeParam = 'endTime=' +date.format('YYYY-MM-DD') + "%20" + $('#endTime').val();
}
var uri = startTimeParam + "&" + endTimeParam + "&" + purposeParam + "&" + carIdParam + "&" + departmentIdParam;
// Add Event to database
$.get( "kfz-buchung-ajax-rent-add?" + uri, function( data ) {
})
.done(function(data){
$('#myModalNew').modal('hide');
})
$('#calendar').fullCalendar( 'refetchEvents' );
});
}
已解决,仅在.click()之前使用.off()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.