我试图在我的项目中使用jquery的自动完成功能.但我不知道为什么它甚至没有打电话.
我把我的jsp文件放在下面..
<input id="productName" name="productName" type="text" placeholder=""/>
Run Code Online (Sandbox Code Playgroud)
在我的js文件中...我写了..
$("#productName").autocomplete({
/*source: '${pageContext. request. contextPath}/search'*/
source: function( request, response ) {
alert('asdfasdfasdfasdfadsf');
$.ajax({
url: "/../search",
data: "q="+request.term,
dataType: "json",
success: function( data ) {
response( $.map( data.values, function( item ) {
return {
label: item.label,
value: item.value
}
}));
}
});
},
minLength: 2,
select: function( event, ui ) {
},
open: function() {
//$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
//$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" ); …Run Code Online (Sandbox Code Playgroud) jquery jquery-ui spring-mvc jquery-autocomplete broadleaf-commerce