jquery输入框自动提示
1. 下载jar包:jquery.autocomplete.js
2. 页面内容:<script type="text/javascript" src="../jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="../autocomplete.css" />
//初始化页面加载项
$(function (){
var options = { serviceUrl:'url路径'};
$('#queryId').autocomplete(options);
});
3.控制器:
public void getContent() throws IOException{
String keyWord = getParameter("query");
//根据keyWord查询匹配的信息
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("\"query\":\""+keyWord+"\",");
sb.append("\"suggestions\":[");
// 加入你自己的数据信息,返回json格式即可。
sb.append("}");
//System.out.println(sb.toString());
}
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17