HTML:
Код: Выделить всё
Код: Выделить всё
var $remote = $('#remote');
$remote.select2({
allowClear: true,
minimumInputLength: 2,
query: function(options){
$.ajax({
dataType: 'json',
url: myURL + options.term,
error: function(jqXHR, textStatus, errorThrown){
smoke.alert(textStatus + ": server returned error on parsing arguments starting with " + options.term);
},
success: function(data, textStatus, jqXHR){
var results = [];
for(var i = 0; i < data.length; ++i){
results.push({id: data[i].id, text: data[i].name});
}
options.callback({results: results, more: false});
}
});
}
});
Код: Выделить всё
Uncaught Error: cannot call val() if initSelection() is not defined
Подробнее здесь: https://stackoverflow.com/questions/132 ... ry-select2
Мобильная версия