javascript - Selectize.js update option label from ajax -


i have drop down select field rendered server, , contains selected option only, value no text.

<select name="countrycode">   <option value="us" selected="selected"></option> </select> 

later, initialize selectize

$('[name=countrycode]').selectize({   load: function(query, callback) {     $.ajax({       url: `countrycode.php?q=${query}`     }).done((data, textstatus, jqxhr) => callback(data.countrycodes));   } }); 

where countrycode.php returns following json

{   countrycodes: [{     text: 'united states',     value: 'us'   },   ... } 

is there way update text label of rendered option?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -