My dropdownmenu is implemented using Select2 and is populated via an Ajax call to PHP, which retrieves data from MySQL.
In the search field of the Select2 dropdownmenu, the letters I type get underlined but the filter functionality does not work. As a result, the list remains unfiltered based on the characters I input. Why is this happening?
Here is the JavaScript code being used:
$(document).ready(function(){
$("#test").select2({
placeholder: "test",
minimumInputLength: 1,
ajax: {
url: "test.php",
dataType: 'json',
//search term
data: function (term, page) {
return {
q: term, // search term
page: page
};
},
results: function (data, page) {
return { results: data};
} //End of results
}, //End of Ajax
}); //End of select2