//模糊查询酒店名称
function autoQueryHotelName(){
$("#hotelName").autocomplete("hotelNameAutoShow.shtml",{
minChars:1,
autoFill:false,
mustMatch:false,
matchContains:false,
max:10,
delay:200,
cacheLength:1,
matchSubset:false,
matchCase:false,
scroll:false,
width : 210,
dataType : 'json',
//如果需要另外传值给action的话可以用这样的方式,如果只是把input里面的值传递给action的话,可以不写
extraParams: {
hotelName: function() {
return $("#hotelName").val();
},
cityCode: function(){
return $("#cityCode").val();
}
},
//进行对返回数据的格式处理
parse: function(data){
//content为我action里面定义的值
var rows = [];
for(var i=0; list = data.content,i<list.length; i++){
rows[rows.length] =
{
//我没有特殊的要求,所以三个写的一样
data:list[i],
value:list[i],
//result里面显示的是要返回到列表里面的值
result:list[i]
};
}
return rows;
},
formatItem:function(item){
//我没有特殊的要求,直接返回了
return item;
}
});
}
jquery.autocomplete
最新推荐文章于 2025-05-20 08:12:16 发布