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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -