Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
How to filter select options based on another select in jQuery using dictionaries?

In first select I choose my species, so in next select i want choose breed from my choosen species. Example: When I choose Cat-species I want see only Ragdoll and Maine Coon in my breeds select, without Yorkshire Terrier because it is a dog. It doesn't work and I don't have any idea how to do that. Now it is : ERR_INCOMPLETE_CHUNKED_ENCODING 200

HTML:

<div class="form-row">
                    <div class="form-group col-md-6 text-center">
                        <label for="species-create" th:text="#{animal.species}"></label>
                        <select id="species-create" class="form-control">
                            <option th:each="species : ${speciesDict}"
                                    th:value="${species.id}"
                                    th:text="${species.value}">
                            </option>
                        </select>
                    </div>
                    <div class="form-group col-md-6 text-center">
                        <label for="breed-create" th:text="#{animal.breed}"></label>
                        <select id="breed-create" class="form-control">
                            <option th:each="breed : findBreeds()"
                                    th:value="${breed.id}"
                                    th:text="${breed.value}">
                            </option>
                        </select>
                    </div>
                </div>

JavaScript

function findBreeds() {
         $.ajax({
             url: "/admin/api/breeds?" + prepareBreedsUrl(),
             type: "get",
             dataType: "json",
             contentType: "application/json"
         })
         .done(function (response) {
             return response;
         })
         .fail(function(jqxhr, textStatus, errorThrown){
             displayErrorInformation(jqxhr.responseText);
         });
}

function prepareBreedsUrl(){
       var species = $("#species-create").find(":selected").val();
          if (species != "") {
             url += "&species=" + species;
          }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda