i currently have an empty drop down list that I would like to fill with some data I got from my database using javascript.
I really have no idea how to do this so right now I am trying this.
Javascript with JQuery.
for (var i=0;i<data.length;i++)
{
var code$=data[i].String1;
var desc$=data[i].Code_Description;
var str$=$('<option value='+code$+'>'+desc$+'</option>');
option$.append(str$);
}
$('#offCode').html(option$);
I have also tried
$('#offCode').append(option$);
but none of this works
Thanks
Try using something like:
The above, obviously, relies on the variables being properly retrieved and filled from your ajax/database-call.