$(document).ready(function() { $('#customRapport').live('click', function(e){ e.preventDefault(); var url = $(this).attr('href'); var title = $(this).attr('title'); var dialogOpts = { bgiframe: true, title: title, width: 500, height: 400, modal: true, open: function(event, ui) { $(this).html('Chargement...'); $(this).load(url); }, buttons: { Valider: function() { formEnvoiCustomRapportSubmit(); }, Annuler: function() { $(this).dialog('close'); } }, close: function() { $('#dialogcustomrapport').remove(); } }; $('
').dialog(dialogOpts); return false; }); }); function formEnvoiCustomRapportSubmit(){ var url = $('#formEnvoiCustomRapport').attr('action'); $.post(url, $('#formEnvoiCustomRapport').serialize(), function (data, textStatus) { if (textStatus!='success'){ $('#dialogcustomrapport').html('Erreur'); } else { $('#dialogcustomrapport').html(data); } } ); }