$(document).ready(function() { initReminder() ; }) ; function initReminder() { var selectorModal = '#modal-reminder' ; $('.btn-reminder').click(function() { $.post($(this).attr('href'), { crudAction: $(this).data('crud-action'), crudControllerFqcn: $(this).data('crud-controller-fqcn'), entityId: $(this).data('entity-id'), id: $(this).data('id'), }, function(html) { $(selectorModal).remove() ; $('body').append(html) ; $(selectorModal).modal('show') ; }); return false ; }) ; $('.checkbox-reminder').click(function() { $.post($(this).data('url'), { id: $(this).data('id'), done: $(this).is(':checked') }, function(data) { SovNotification.add('success', 'Pense-bête mis à jour'); }, 'json'); }) ; }