$('#users').select2({
multiple: true,
cache: false,
allowClear: true,
language: "ru",
placeholder: 'Для поиска начните печатать',
/*initSelection: function(element, callback) {
$.ajax({
type: "POST",
url:'/api',
data:{'task':'loadtask','account_id':$("#account_id").val()},
cache: false,
success: function(data){
var task = jQuery.parseJSON(data);
if (task!=0) {
setTask(task[0]['task'],'#task-'+task[0]['task']);
callback(task);
} else {
return false;
}
}
});
},*/
createSearchChoice: function (data) {
return {id: data, username: data};
},
ajax: {
url: "/api",
type: "POST",
dataType: 'json',
data: function (data) {
return {
'instagram': 'search',
'login': data.term
};
},
processResults: function (data) {
return {
results: data
};
}
},
templateResult: formatData,
templateSelection: formatData,
escapeMarkup: function (m) {
return m;
},
minimumInputLength: 1
});
Добавь и покажи что выдает