DEPENDENT SELECTS WITH CLASS="chosen-select"

0

I am trying to make a form with dependent dropdown, but the problem is when I go from select 1 to select 2 that has the class "chosen-select", it does not show me the data in this dropdown , but if I change the class to this dropdown and put it "form-control", if you pass me the necessary data.

How can I use the "chosen-select" class in SELECT 2 and read the data to be filtered afterwards?

Select 1

<select id="jornada" class="form-control" name="jornada" required>
            <option value="">-- SELECCIONE --</option>
            <?php 
                    while ($row=mysqli_fetch_array($jornada)) {                     
                    echo '<option value='.$row["id"].'>'.$row["jornada"].'</option>';
                    }
                    mysqli_free_result($jornada)
             ?>            
</select>

Select 2 - Ideally, in this dropdown I can search, instead of selecting

<select id="r_ruta" class="chosen-select" name="r_ruta" required>
    <option value="">-- SELECCIONE --</option>
</select>

Script

$(document).ready(function(){
        $("#jornada").change(function(){
            $.get("get_colegios.php","jornada_id="+$("#jornada").val(), function(data){
                $("#r_ruta").html(data);
                console.log(data);
            });
        });
});

Thanks for your help

    
asked by Andres Arango 17.07.2018 в 05:51
source

0 answers