I'm a bit lost with the JSON format I must return for Select2 so it works.
My returned JSON captured with fiddler:
And my Select2 setup (#FuncionarioID is a select input):
$('#FuncionarioID').select2({
ajax: {
dataType: "json",
url: "Ajax.ashx?Action=FuncionarioSelect2",
results: function (data) {
return { results: data };
},
cache:false
}
});
I've been reading questions about the same subject here in Stackoverflow, I tried the answers and none of them worked for me. Would you have any tip about solving this problem? I've already tried to return objects like this {"id":"1060","text":"teste 1"} and it didn't work too.
Thanks in advance for any help.