Код: Выделить всё
function SetSelect(obj, placeholder, url) {
obj.select2({
placeholder: placeholder,
theme: "bootstrap",
language: "es",
ajax: {
url: url,
dataType: "json",
data: function (params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;
return {
results: data
};
}
},
});
}
Подробнее здесь: https://stackoverflow.com/questions/448 ... trapdialog