Conjunto de cambios 9674858 en consulta_publica para static


Ignorar:
Fecha y hora:
23/05/2017 15:17:12 (hace 7 años)
Autor:
rudmanmrrod <rudman22@…>
Branches:
master, constituyente, estudiantes, general, plan_patria, sala
Children:
8e6197e, 5a86f8c
Parents:
2d9334e
Mensaje:

Agregado recarga de captcha por ajax

Fichero:
1 editado

Leyenda

No modificado
Añadido
Eliminado
  • static/js/funciones.js

    r4a10874 r9674858  
    808808
    809809/**
    810  * Función que recarga la imágen del captcha, ***falta depurar***
     810 * @brief Función para recargar el captcha vía json
     811 * @param element Recibe el botón
    811812 */
    812 $(document).ready(function() {
    813   $('.js-captcha-refresh').click(function(){
    814     //alert("xxxxx");
    815     /*$form = $(this).parents('form');
    816     $.getJSON($(this).data('url'), {}, function(json) {
    817       // This should update your captcha image src and captcha hidden input
    818     });
    819     return false;*/
    820     location.reload();
    821   });
    822 });
     813function refresh_captcha(element) {
     814    $form = $(element).parents('form');
     815    var url = location.protocol + "//" + window.location.hostname + ":" + location.port + "/captcha/refresh/";
     816
     817    $.getJSON(url, {}, function(json) {
     818        $form.find('input[name="captcha_0"]').val(json.key);
     819        $form.find('img.captcha').attr('src', json.image_url);
     820    });
     821
     822    return false;
     823}
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.