Change state a select to disabled

0

I have this design

When I give the button assign it saves me the information in a table of sql and I need the select to be disabled and although I update the page always remain disabled .

this is the jade

table(id='example-table' class='table table-fixed analisisD')
        thead
          tr
            th='Articulo'
            th='Descripción'
            th='Um'
            th='Ov'
            th='#Ubic'
            th='Teorico'
            th(class='vi1')='Conteo1'
            th(class='vi2')='Conteo2'
            th(class='vi3')='Conteo3'
            th='Dif'
            th='Dif $'
            th(class='vi2')='Asignar conteo'
            th='Seleccionar'
              input(type="checkbox" id='selectall')

          tbody(class='unico')
          if ListArticulos != undefined
            each Articulos in ListArticulos
              tr(class='Art')
                td(id='id_articulo' class='iarticulo')= Articulos.SI_Articulo
                td= Articulos.SI_Descripcion
                td= Articulos.SI_UM
                td= Articulos.SI_OV
                td
                  button(type='button' id='btn-analisisInterno' class='btn btn-danger' data-toggle='modal' data-target='#myModal')= Articulos.SI_Ubicacion
                td= Articulos.SI_Existencia
                td(class='vi1')= Articulos.SI_Cantidad
                td(class='vi2')= Articulos.SI_Cantidad2
                td(class='vi3')
                td= Articulos.SI_Dif
                td= Articulos.SI_Dif_Dinero
                td(class='vi2 sel')
                  select(id='widthSelect' class='form-control widthSelect' name='mood')
                    option(name="0" value="0") -- Seleccione usuario --
                    option(name="1" value="1") 1020433143
                    option(name="2" value="2") 1026138136
                    option(name="3" value="3") 1037618420
                    option(name="4" value="4") 1128430921
                    option(name="5" value="5") 1152683886
                    option(name="6" value="6") 15255651
                    option(name="7" value="7") 43222012
                    option(name="8" value="8") 71268442
                    option(name="9" value="9") 71703960
                    option(name="10" value="10") 8463111
                    option(name="11" value="11") 98514535
                    option(name="12" value="12") 98643619
                    option(name="13" value="13") Admin
                td
                  input(type="checkbox" id='hola' class='case' name='case')

and in this way I save by clicking on the button asignar

$(function() {
    $('.asignarConteo').on('click', function(e) {
        $('.widthSelect :selected[value!="0"]').closest("tr").each(function() {
            //console.log(
            //    $(this).find(".iarticulo").text(),
            //    $(this).find(":selected").text());
            var ar = $(this).find(".iarticulo").text();
            var usu = $(this).find(":selected").text();
            //alert(ar + usu);
            $.ajax({
                url: 'http://localhost:3000/AsigUsuarios',
                method: 'post',
                data: { idArticulo: ar, Usuario: usu },
                success: function(res) {
                    console.log(res);
                }
            });
        })
    });

});
    
asked by Eduard 24.07.2017 в 02:11
source

1 answer

1

You need to store the state of the select somewhere. You can use for example localStorage ( link ) for this purpose.

Another alternative that I think is more correct is that this state is stored in the database when you update, that way when you refresh the new state comes in the response from the server, and in the browser you only have to interpret it.

Greetings.

    
answered by 24.07.2017 / 13:01
source