I use select2 with ajax search.How to set some option couldn't be selected.
for example,like the image below
I wrote a 'w' in the input, but the first line in the drop down is not the data come from ajax search. how to set it couldn't be selected or don't show it?
html code
<select id="normalSymptom" name="normalSymptom" class="form-control select2-multiple" multiple > </select>
javascript code
$('#normalSymptom').select2({
tags: true,
multiple: true,
tokenSeparators: [','],
minimumInputLength: 1,
minimumResultsForSearch: 10,
ajax: {
url: "/DiseaseSearch/symptomSearch",
dataType: "json",
type: "GET",
data: function (params) {
var queryParameters = {
word: params.term
}
return queryParameters;
},
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.name,
id: item.id
}
})
};
}
}
});
white
tag come form ajax. butw
is what I input