the last days I'm trying this topic I try to use the select2 I do the search but it does not show the results, apart from the select2 I have 2 inputs that are autopleted with the information that brings ajax , I hope to find a solution to this problem.
Thanks.
HTML CODE
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-4">Producto</label>
<div class="col-md-12">
<select class="form-control select2" id="producto"
style="width: 100%">
</select> <span class="help-block"></span>
</div>
</div>
</div>
JQUERY
$("#producto").select2({
placeholder: "Buscar producto",
allowClear: true,
minimumInputLength: 1,
ajax: {
url: baseurl + 'Venta/obtener_producto',
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term
};
},
processResults: function (data) {
return {
results: data
};
},
cache: true
},
});