如何让select2选择下拉菜单?我下面的代码有错误
jQuery.Deferred异常:无法读取未定义Type的属性'length'
代码:
$("#select").select2({
minimumInputLength: 1,
tags: [],
placeholder:'Cari',
ajax: {
url: 'http://jsonplaceholder.typicode.com/users',
dataType: 'json',
type: "GET",
quietMillis: 50,
data: function (term) {
return {
term: term
};
},
results: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.name,
id: item.id
}
})
};
}
} });
预先感谢