
您好,可以有人指导我在我的ajax请求,它总是只显示我八个记录。
$(this).typeahead({
source: function (query, process) {
jQuery.ajax({
url: url + "/ajax/productdetail",
type: 'GET',
limit: 10,
data: {
cat: $type,
name: query,
form: $form,
setupid: $setupid
},
dataType: 'json',
success: function (response) {
objects = [];
map = {};
$.each(response, function (i, object) {
//debugger;
map[object.name] = object;
objects.push(object.name);
});
process(objects);
}
});
}
});

发布于 2014-04-23 19:22:20
只需在实例化typeahead方法时添加一个选项"items“。希望下面的例子能帮助你理解。
$('input#auto-complete-field').typeahead({
minLength : 0,
items: 9999,
source: function (query, process) {
objects = [];
map = {};
$.ajax({
.......
......
});
}
updater: function(item) {
.............
.............
}
});https://stackoverflow.com/questions/22022596
复制相似问题