source: portal_2019/js/partial-4.js @ 7aedf03

devportal
Last change on this file since 7aedf03 was 0320f1b, checked in by Angelo Osorio <danielking.321@…>, 5 years ago

cambios en el frontend

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 * Función que se conecta se servicio web de verificación de la firma electrónica captura el evento submit y toma
3 * el formulario para enviar el servicio web.
4 */
5
6$(function() {
7  $("#verificar").on("submit", function(e){
8    e.preventDefault();
9    var f = $(this);
10    var formData = new FormData();
11    formData.append("upload", $("#file-check-sign")[0].files[0]);
12    $.ajax({
13      url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/firmados",
14      headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},
15      type: "post",
16      dataType: "json",
17      data: formData,
18      cache: false,
19      contentType: false,
20      xhrFields: { withCredentials: true },
21      processData: false,
22      success: function(response) {
23        var tempJson = JSON.stringify(response);
24        var jsonparsed = JSON.parse(tempJson);
25        var fileType = jsonparsed['mimeType'];
26        var html;
27        if (fileType == 'application/pdf') {
28          html = manejoJsonPDF(JSON.stringify(response));
29        } else {
30          html = manejoJsonBDOC(JSON.stringify(response));
31        }
32        document.getElementById("respuestaVerificacion").innerHTML = html;
33      },
34      error: function(response) {
35        //Que se ejecuta cuando finalice la petición de con error
36        $("#respuestaVerificacion").html('¡Error!' + response);
37      }
38    });
39  });
40});
Note: See TracBrowser for help on using the repository browser.