Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

143
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda