$('.popup').on('click', function(event, element) { // Display the modal and set the values to the event values. var section = $(this).data('section'); var section_id = $(this).data('section_id') var section = $(this).data('section') var id = $(this).data('id') var section_type = $(this).data('section_type') var details_id = $(this).data('details_id') $.ajax({ url: 'index.php/projets/form_tache/'+id+'/'+section+'/'+section_id+'//'+section_type+'/'+details_id , type: 'get', dataType: 'json', success: function(responseData){ $('#tacheform').html(responseData) ; } }); $('#myModal').modal('show'); var section = $(this).data('section'); var id = $(this).data('id'); var section_type = $(this).data('section_type'); var details_id = $(this).data('details_id'); // $('.modal').find('#title').val(event.title); // $('.modal').find('#starts-at').val(event.start); // $('.modal').find('#ends-at').val(event.end); } ); // Bind the dates to datetimepicker. // You should pass the options you need $("#starts-at, #ends-at").datetimepicker(); // Whenever the user clicks on the "save" button om the dialog $('#save-event').on('click', function() { var title = $('#title').val(); if (title) { var eventData = { title: title, start: $('#starts-at').val(), end: $('#ends-at').val() }; $('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true } $('#calendar').fullCalendar('unselect'); // Clear modal inputs $('.modal').find('input').val(''); // hide modal $('.modal').modal('hide'); });