Select
If you want to allow the user to choose from more than one option, select the lists. The following example includes a selection list.
// Select2 AJAX
$("#foSelectAjax").select2(
{
language: {
searching: function () {
return "Searching...";
}
},
ajax: {
url: 'https://api.github.com/search/repositories',
dataType: 'json',
type: "GET",
delay: 250,
data: function (params) {
return {
q: params.term
};
},
processResults: function (data) {
var res = data.items.map(function (item) {
return { id: item.id, text: item.name };
});
return {
results: res
};
}
},
});
More information; https://select2.org/