- Fecha y hora:
- 18/04/2017 09:55:46 (hace 7 años)
- Branches:
- master, base, constituyente, estudiantes, general, plan_patria, sala
- Children:
- 7310249
- Parents:
- f791bc4
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
static/js/funciones.js
rf791bc4 r6abfabc 499 499 var form = $("#encuesta_form"); 500 500 var routes = $(location).attr('pathname').split('/') 501 var id = routes[routes.length-1] 502 $.ajax({ 503 type: 'POST', 504 data: $(form).serialize(), 505 url: "/participacion/"+id, 506 success: function(response) { 507 if (response.code == true) { 508 bootbox.alert("Se registró su participación con éxito <br>Será direccionado en 4 segundos"); 509 setTimeout(function(){ 510 $(location).attr('href', $(location).attr('origin')+'/participacion-busqueda/'+id) 511 },4000); 512 } 513 else{ 514 bootbox.alert("Ocurrió un error inesperado"); 515 $('.btn-success').attr('disabled',false); 516 } 517 }, 518 error:function(error) 519 { 520 bootbox.alert("Ocurrió un error inesperado"); 521 $('.btn-success').attr('disabled',false); 522 } 501 var pk = routes[routes.length-1] 502 var ente = routes[routes.length-2] 503 var ente_adscrito = routes[routes.length-3] 504 var pks = pk+"/"+ente+"/"+ente_adscrito 505 $.ajax({ 506 type: 'POST', 507 data: $(form).serialize(), 508 url: "/participacion/"+pks, 509 success: function(response) { 510 if (response.code == true) { 511 bootbox.alert("Se registró su participación con éxito <br>Será direccionado en 4 segundos"); 512 setTimeout(function(){ 513 $(location).attr('href', $(location).attr('origin')+'/participacion-busqueda/'+pk) 514 },4000); 515 } 516 else{ 517 bootbox.alert("Ocurrió un error inesperado"); 518 $('.btn-success').attr('disabled',false); 519 } 520 }, 521 error:function(error) 522 { 523 bootbox.alert("Ocurrió un error inesperado"); 524 $('.btn-success').attr('disabled',false); 525 } 523 526 }); 524 527 … … 670 673 }); 671 674 } 675 676 /** 677 * Función que despliega el modal para crear los archivos de respuesta 678 * de la consulta 679 */ 680 function create_files(){ 681 var routes = $(location).attr('pathname').split('/') 682 var pk = routes[routes.length-1]; 683 var html = ''; 684 $.ajax({ 685 type: 'GET', 686 url: "/administrador/consulta/ajax/valid-dir/"+pk, 687 success: function(response) { 688 if (response.code == true) { 689 html+= "El directorio existe, ¿desea sobreescribirlo?"; 690 } 691 else{ 692 html+= "El directorio no existe, ¿desea crearlo?"; 693 } 694 bootbox.dialog({ 695 message: html, 696 title: "Generar Texto de Respuestas", 697 buttons: { 698 success: { 699 label: "Si", 700 className: "btn-success", 701 callback: function() { 702 create_text_files(pk); 703 } 704 }, 705 close: { 706 label: "No", 707 className: "btn-danger", 708 callback: function() {} 709 } 710 } 711 }); 712 }, 713 error:function(error){ 714 bootbox.alert("Ocurrió un error inesperado"); 715 } 716 }); 717 } 718 719 /** 720 * Función que crea los textos 721 */ 722 function create_text_files(pk){ 723 $.ajax({ 724 type: 'GET', 725 url: "/administrador/consulta/ajax/generar-textos-respuesta/"+pk, 726 success: function(response) { 727 bootbox.alert(response.mensaje); 728 }, 729 error:function(error){ 730 bootbox.alert("Ocurrió un error inesperado"); 731 } 732 }); 733 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.