/** * Función que se conecta al servicio web de verificación de la firma * electrónica captura el evento submit y toma el formulario para enviar el * servicio web. */ $(function() { $("#verificar").on("submit", function(e){ e.preventDefault(); var f = $(this); var formData = new FormData(); formData.append("upload", $("#file-check-sign")[0].files[0]); $.ajax({ url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/firmados", headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, type: "post", dataType: "json", data: formData, cache: false, contentType: false, xhrFields: { withCredentials: true }, processData: false, success: function(response) { var tempJson = JSON.stringify(response); var jsonparsed = JSON.parse(tempJson); var fileType = jsonparsed['mimeType']; var html; if (fileType == 'application/pdf') { html = manejoJsonPDF(JSON.stringify(response)); } else { html = manejoJsonBDOC(JSON.stringify(response)); } document.getElementById("respuestaVerificacion").innerHTML = html; }, error: function(response) { //Que se ejecuta cuando finalice la petición de con error $("#respuestaVerificacion").html('¡Error!' + response); } }); }); });