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

280
Vistas
How to append the json results to select dropdown using php jax?

I have list of json results but cant get into select html tried the following code

Json ouput: jquery loop on Json data using $.each

{"Eua":"Eua","Ha'apai":"Ha'apai","Niuas":"Niuas","Tongatapu":"Tongatapu","Vava'u":"Vava'u"}

 success: function(result){
                    
                    console.log(data);
                    var data = jQuery.parseJSON(result);
                    jQuery.each(data,function(key, value)
                {   //jQuery("#state").html();
                    console.log(key);
                    jQuery("#state").html('<option>'+value+'</option>');
                })
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Using the instruction

jQuery("#state").html(...)

would replace the previous option with new one, so you will always get only one option, which is the last Json value.

You should use

jQuery("#state").append(...)

This instruction would append an option to the select dropdown, remaining the previous options in place.

about 4 years ago · Juan Pablo Isaza Denunciar
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