function upload(btn) { if ($("#blob").val()) { swal({ title: "'.tr('Avviare la procedura?').'", type: "warning", showCancelButton: true, confirmButtonText: "'.tr('Sì').'" }).then(function (result) { var restore = buttonLoading(btn); $("#upload").ajaxSubmit({ url: globals.rootdir + "/actions.php", data: { op: "save", id_module: "'.$id_module.'", id_plugin: "'.$id_plugin.'", }, type: "post", success: function(data){ data = JSON.parse(data); if (!data.already) { launch_modal("'.tr('Righe fattura').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&id_plugin=" + '.$id_plugin.' + "&op=list&filename=" + data.filename); } else { swal({ title: "'.tr('Fattura già importata.').'", type: "info", }); $("#blob").val(""); } buttonRestore(btn, restore); }, error: function(data) { alert("'.tr('Errore').': " + data); buttonRestore(btn, restore); } }); }) } else { swal({ title: "'.tr('Selezionare un file!').'", type: "error", }) } }