0
I managed to make the Select2 Plugin work, but the autocomplete does not work.
$(function () {
$("#disciplina").select2({
placeholder: "Disciplina",
minimumInputLength: 0,
ajax:{
url: "busca.asp",
type: "post",
dataType: "json",
delay: 150,
data: function(params){
return{
text: params.term
};
},
processResults: function(data, params){
params.page = params.page || 1;
return{
results: data,
pagination:{
more: (params.page * 30) < data.total_count
}
};
},
cache: true
}
});
});
Someone’s been through it?
Return with console.log(date);
console.log(params);
You can dump the information you are receiving from the server (console.log)
– Jorge Costa
@Jorgecosta already tried to put the console in the return of ajax, but the function stops working. Return{ console.log(params.term); text: params.term };
– Rod
Dude, I’m about 3 weeks into this popular select one, it’s really hard. I came close now, but I’m bumping into this.
– Rod
Console.log(data) before Return, if you’re using Chrome see the inspector
– Jorge Costa
@Jorgecosta did in processResults and it worked, I will post in the question the return image.
– Rod
I published an answer essentially it is your responsibility to filter the data on the server side when you use ajax
– Jorge Costa