You can use select2.js, it is a search component just like the select you are using, but it makes calls to the server with ajax by filtering by the value typed in it. I think that's what you need.
To use it is very easy
Add these 2 files to the head of your site
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
and to use it simply do the following:
Mount the html:
<select class="js-data-example-ajax">
<option value="3620194" selected="selected">select2/select2</option>
</select>
and create the javascript responsible for configuring the component:
$(".js-data-example-ajax").select2({
ajax: {
url: "https://api.github.com/search/repositories",
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function (data, page) {
// parse the results into the format expected by Select2.
// since we are using custom formatting functions we do not need to
// alter the remote JSON data
return {
results: data.items
};
},
cache: true
},
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: 1,
templateResult: formatRepo, // omitted for brevity, see the source of this page
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
});
If you need more information just go to the official website:
link