source: portal_2019/js/partial-4.js @ 8f2445f

devportal
Last change on this file since 8f2445f was bbe2084, checked in by Angelo Osorio <danielking.321@…>, 5 years ago

Portal funcional

  • Property mode set to 100644
File size: 1.4 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        $('table.display').dataTable();
34      },
35      error: function(response) {
36        //Que se ejecuta cuando finalice la petición de con error
37        $("#respuestaVerificacion").html('Error...!!!');
38      }
39    });
40  });
41});
Note: See TracBrowser for help on using the repository browser.