Changeset b14db79 in sicp


Ignore:
Timestamp:
Jun 11, 2015, 12:10:32 PM (9 years ago)
Author:
Ing. Roldan D. Vargas G <rvargas@…>
Branches:
master
Children:
59320a5
Parents:
f8ea66d
Message:

agregada instrucciones AJAX para mostrar en el select los años de registro de los productos

File:
1 edited

Legend:

Unmodified
Added
Removed
  • static/js/funciones.js

    raca0dad rb14db79  
    124124    if (tipo=="ue") {
    125125        /** Requerimientos de divisas por Unidad Económica */
    126 
     126        get_params = {rif: id};
    127127    }
    128128    else if (tipo=="pr") {
    129129        /** Requerimientos de divisas por producto */
     130        get_params = {pr_id: id};
    130131    }
    131132
     
    193194    $(modal).find('[data-toggle="tooltip"]').tooltip({});
    194195    $(modal).find('.select2').select2({});
     196
     197    $.getJSON(URL_ANHOS_PRODUCTOS, get_params, function(datos) {
     198        if (datos.resultado) {
     199            for (i=0; i<datos.anhos.length; i++) {
     200                $(modal).find("#anhoregistro").append("<option value='"+datos.anhos[i]+"'>"+datos.anhos[i]+"</option>");
     201            }
     202        }
     203        else {
     204            bootbox.alert(datos.error);
     205        }
     206    }).fail(function(jqxhr, textStatus, error) {
     207        var err = textStatus + ", " + error;
     208
     209        bootbox.alert(ERROR_AJAX_REQUEST + err);
     210    });
    195211}
    196212
     
    286302    $(modal).find('[data-toggle="tooltip"]').tooltip({});
    287303    $(modal).find('.select2').select2({});
    288 }
     304
     305    // Instrucción AJAX que permite obtener los años de registro del producto seleccionado
     306    $.getJSON(URL_ANHOS_PRODUCTOS, {pr_id:id}, function(datos) {
     307        if (datos.resultado) {
     308            for (i=0; i<datos.anhos.length; i++) {
     309                $(modal).find("#anhoregistro").append("<option value='"+datos.anhos[i]+"'>"+datos.anhos[i]+"</option>");
     310            }
     311        }
     312        else {
     313            bootbox.alert(datos.error);
     314        }
     315    }).fail(function(jqxhr, textStatus, error) {
     316        var err = textStatus + ", " + error;
     317
     318        bootbox.alert(ERROR_AJAX_REQUEST + err);
     319    });
     320}
Note: See TracChangeset for help on using the changeset viewer.