Hi,
I am returning items by ajax. When I search for an item it shows. What I would like to do is have the items dropdown in a list when I tab to the search field.
All it shows is Searching…
Here’s my code:
$('#students').select2({
dropdownParent: $("#modal-add-placement"),
ajax: {
url: function (params) {
return '/dashboard/placement/get-students/' + params.term;
},
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {id: item.id, text: item.text};
})
};
}
},
allowClear: true,
placeholder: 'Type Student\'s name',
tokenSeparators: [',', ' '],
language: {
errorLoading: function () {
return "Searching..."
}
},
cache: true
});
I must be missing something since I have found a way to do this.
Thanks in advance.