I need to feed cities based on country of selection. I did it programmically but have no idea how to put JSON data into the select box. I tried several ways using jQuery, bu
Take a look at JQuery view engine and just load the array into a dropdown:
$.ajax({
url:'suggest.html',
type:'POST',
data: 'q=' + str,
dataType: 'json',
success: function( json ) {
// Assumption is that API returned something like:["North","West","South","East"];
$('#myselect').view(json);
}
});
See details here: https://jocapc.github.io/jquery-view-engine/docs/ajax-dropdown