$('#patient').select2({
minimumInputLength: 3,
ajax: {
url: '{{ route("api.patients.search") }}',
dataType: 'json',
method:'GET',
processResults: function (data) {
// console.log(data); // Log the data to the console
return {
results: data.results.map(function(patient) {
return {
id: patient.id,
text: patient.text + " - " + patient.name,
};
})
};
}
},
});
$('#patient').select2({
minimumInputLength: 3,
ajax: {
url: '{{ route("api.patients.search") }}',
dataType: 'json',
method:'GET',
processResults: function (data) {
// console.log(data); // Log the data to the console
return {
results: data.results.map(function(patient) {
return {
id: patient.id,
text: patient.text + " - " + patient.name,
};
})
};
}
},
});