我正在尝试使用支持 AJAX的DevBridge jQuery 自动完成插件。
我已经创建了所有必需的部分,但插件没有给我任何结果。控制台没有给我任何错误。
function initializeSubjectAutocomplete()
{
/* Add field */
realSubjectSelector = $('#containerForm select#subject');
realSubjectSelector.hide();
realSubjectSelector.after('<input type="text" placeholder="Subject" id="subjectAutocomplete" name="subjectAutocomplete">');
/* Autocomplete */
$('#containerForm input#subjectAutocomplete').autocomplete(
{
serviceUrl: 'getAutocompleteThreads',
dataType: 'jsonp',
minChars: 3,
onSelect: function (suggestion){realSubjectSelector.val(suggestion.data);}
}
);
}
我的 getAutocompleteThreads 的典型结果格式如下:
{
query: "resolvi",
suggestions: [
{ value: "Not resolving Symlinks at all", data: "13102" },
{ value: "Resolving inter-library dependencies", data: "12079" },
{ value: "Resolving static lib dependency at executable link time", data: "13098" },
{ value: "help needed in resolving this pipeline problem", data: "59531" },
{ value: "Resolving coincident faces - linear & quadratic quarilaterals", data: "68186" }
]
}
感谢您的时间,
菲利克斯