I make select2 from , without . I get its by ajax in select2. But no one of rows in dropdown list I have after successful request was.
I don’t understand what I do not right(
$('#cars-select').select2({
allowClear: true,
closeOnSelect: false,
placeholder: 'Выберите автомобили',
ajax: {
url: '/sklad/get-cars',
dataType: 'json',
delay: 1000,
data: function (params) {
return {
term: params.term,
marks: $('#marks-select').val(),
agregat_id: {$agregat->id}
}
},
processResults: function (data) {
console.log(data);
return data;
},
},
templateSelection: function (state) {
return $(state.text)
},
templateResult: function (state) {
return $(state.text)
},
})