I am creating an application and I need to be able to move the events of the fullcalendar and edit them, the code to edit it and it works, the problem is that when moving events and canceling them, you save the id of the canceled events and edit one Edits them all, makes the edit of all as if it were a cycle, this is my code:
eventDrop: function(event, delta, revertFunc) {
var id_edit=0;
$('#moverDia').modal({backdrop: 'static', keyboard: false});
$('#titulo_edit').html(event.title);
var fecha = event.start.format();
var separador = "T";
var resul = fecha.split(separador);
$('#fecha_edit').html(resul[0]);
var horaI=$('#hora_inicioE').val();
var horaF=$('#hora_finE').val();
$('#aceptar_cambio').click(function(){
id_edit=event.id;
/* $.ajax({
url:"/editarC/"+event.id,
type:"POST",
data:{"_token":"{{ csrf_token() }}",fecha_inicio:resul[0],hora_inicio:horaI,hora_fin:horaF}
}).done(function(){
alert('funciono :v');
}).fail(function(){
alert('no funciono :v ');
}); */
});
$('#negar_cambio').click(function(){
alert('el tamaño es '+event.id);
revertFunc();
});
},
I do not know why, by clicking on accept change, you edit them all, if anyone knows why this happens, I would greatly appreciate the information.