source: portal_2019/js/partial-4.js @ 3483075

devportal
Last change on this file since 3483075 was 0155753, checked in by Argenis Osorio <argenisosorio580@…>, 9 months ago

Agregados archivos restantes al seguimiento de git

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