JSFiddle - React, Tailwind, and code Playground
by John Grivas
HTML
<select id="options">
<option value="select">Select</option>
</select>
JavaScript
var data={"routes":[
{
"route_id":"4",
"company_id":"2",
"from":"Soye",
"to":"Martelange",
"fare":"98",
"is_active":"",
},
{
"route_id":"9",
"company_id":"2",
"from":"Auckland",
"to":"Stevoort",
"fare":"65",
"is_active":"",
}
]}
var jsonArray = data.routes;
var options = $("#options");
$.each(jsonArray , function(index, data) {
//adds all this values fron the array ,only from and to
options.append($("<option/>").text(data.from + " / " + data.from));
});