我正在尝试为搜索用户实现自动完成
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<title>Insert title here</title>
<script type='text/javascript' src="js/jquery.autocomplete.js"></script
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script type="text/javascript">
$(document).ready(function(){
$('#search').keyup(function() {
var search = $('#search').val();
if(search.length>2){
$.ajax({
type:"POST",
url: "searchuser",
cache:false,
data: 'search=' + $("#search").val() ,
success: function(response){
$.each(response, function (index, value) {
alert(value);
}
);
},
error: function(e){
alert('Error: ' + e);
}
});
}
});
});
</script>
</head>
<body>
<form>
<input id="search" type="text" name="search" />
</form>
</body>
</html>
我正在从数据库中获取值并能够使用警报弹出值但我想使用该值实现自动完成任何人都可以建议我如何通过 spring MVC 上的示例