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

144
Vistas
Going from a CSV on the local server to populate a dropdown

Absolutely brand new to JS. I want to take a csv stored on the localhost and then use the contents to populate a drop down list. I have:

    <form id="database" name="database" onsubmit="return validateForm()" method="POST" action="" enctype="multipart/form-data">
      <label>Customer:</label>
      <select id="custnum" name="custnum">
      </select>

I was then going to put the contents of the csv in the drop down using:

    <script>
    $.get( "/data/test1.csv", function(CSVdata) {
    data = new Array ($.csv.toArray(CSVdata)); 
    console.log(data)}); ##using this to view if I even had it in the array list
    </script>

But this throws: TypeError: Cannot read properties of undefined (reading 'toArray')

Whenever this was going to start working, I was going to do:

var dropdown = $('custnum');
        for(var i = 0; i < data.length; i++) {
            var record = data[i];
            var entry = $('<option>').attr('value', record.someProperty);
            dropdown.append(entry);
        }
   
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