Do not load the data in the select tag using materialize

1

I am sending some data by jquery to the html and it sends them. but the select does not show them I think it's because I use a css framework called materialize, and by not selecting the js of the select again, it does not load the data I sent.

success: function(respuesta){

                        var obj = JSON.parse(respuesta);

                         for (i=0; i<obj.length; i++) {

                         console.log(obj[i].descripcion_necesidad);

                         $("#categoriaidea").append('<option>'+obj[i].descripcion_necesidad+'</option>');

                          }

                        }

this part is where I sent jquery to html

<div class="input-field col s12">
                <select id="categoriaidea">
                  <option id="cargafoco" value="" disabled selected>Eliga una opcion</option>
                  </select>
                <label>Necesidad</label>
              </div>

This is where I want to show in the html. use framework materialize

    
asked by Alberto Julio Arce Escolar 29.05.2018 в 21:28
source

1 answer

0

solved if someone serves you

  success: function(respuesta){

                        var obj = JSON.parse(respuesta);

                         for (i=0; i<obj.length; i++) {

                         console.log(obj[i].descripcion_necesidad);

                          $(document).ready(function() {

                         $("#categoriaidea").append('<option >'+obj[i].descripcion_necesidad+'</option>');
                         });

                          }

                           $(document).ready(function() {
                                 $('select').material_select();
                               });

                        }
    
answered by 29.05.2018 в 22:28