diff --git a/templates/web/common/dialog_export.html.twig b/templates/web/common/dialog_export.html.twig index e1aad473d1..10abce3605 100644 --- a/templates/web/common/dialog_export.html.twig +++ b/templates/web/common/dialog_export.html.twig @@ -794,8 +794,8 @@ ); }); - $('#sendmail .sendmail_button').bind('click',function(){ - if(!check_subdefs($('#sendmail'))) { + var submitEmailForm = function () { + if (!check_subdefs($('#sendmail'))) { return false; } @@ -803,12 +803,18 @@ return false; } - if ($('iframe[name=""]').length === 0) { - $('body').append(''); - } + $.post('{{ path('export_mail') }}', $('#sendmail form').serialize(), function (response) { + dialog.Close(); + }); + return false; + }; - $('#sendmail form').submit(); - dialog.Close(); + $('#sendmail form').on('submit', function () { + return submitEmailForm(); + }); + + $('#sendmail .sendmail_button').on('click', function () { + return submitEmailForm(); }); $('.datepicker', dialog.getDomElement()).datepicker({