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);
}