input输入框自动补全与联想

1 下载 jq autocomplete

    官网:(https://www.devbridge.com/sourcery/components/jquery-autocomplete/)

2 ajax请求

//输入框联想
(function() {('#title').autocomplete({
serviceUrl: "manve/search/searchTitle/titleLenovo.do",
type:'POST',
deferRequestBy:500
});
});

接口返回的json格式为

{
// Query is not required as of version 1.2.5
"query": "Unit",
"suggestions": [
{ "value": "United Arab Emirates", "data": "AE" },
{ "value": "United Kingdom", "data": "UK" },
{ "value": "United States", "data": "US" }
]
}