I had something like this before in my client side code:
<select name="carlist" class="form-control">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Since all the values are hard coded above, I needed to replace it with the values I am getting from a webservice (JSON response), so I did the following using jQuery and it’s working also:
$.each(data_.cvtermList, function(key, value) {
$("#carlist").append (
"<option>"+value.carName+"</option>"
)
});
So basically the above code is populating the drop down list in the same manner as I had before(hard coded).
I am wondering in my HTML conversion in Javascript which I have done like this "<option>"+value.carName+"</option>"
, do I need to include value="volvo"
also somehow in my javascript code?