one way you can use with ajax:
$.ajax({ url: url, type: 'GET', dataType: 'json', cache: false, data: search }).done(function(data){ $.each(data, function(){ $('<option />', {value: this.value, text: this.text}).appendTo(selectObj); }); chosenObj.trigger('liszt:updated'); });
where selectObj is a special selection object
But...
Selected is very poorly implemented. It has several visual errors, for example: select an option, then start searching for a new one, then delete the selected ones and continue typing - you will get "Select some options", for example, "Select some search options." It does not support jQuery chaining. If you try to implement AJAX, you will notice that when you lose the focus of the selected one, the text will disappear, now when you click again, it will show some values. You can try to remove these values, but it will not be easy because you cannot use the blur event because it also fires when some values ββare selected. I suggest not using select ones at all, especially with AJAX.
source share