求助Jquery Autocomplete 如何动态加载数据,类似百度的搜索提示
2个回答
展开全部
function noconditiontishi1(){
$("#selectfundsname1").autocomplete({ //提示
minLength: 0,
contentType : 'application/x-www-form-urlencoded; charset=utf-8',
source:function(request,response){
$.ajax({
url:"/fund/supermarket/tishi1.do",
data:"keywords="+$("#selectfundsname1").val(),
dataType:"json",
type:"post",
success:function(data){
response($.map(data.selectFundInfos, function(item) {
return { label:item.fundname, value: item.fundcode };
// lable为显示值:value为实际值
}));
}
});
},
focus: function( event, ui ) {
return false;
},
select: function( event, ui ) {
var s=ui.item.label;
var labels=s.substring(0,s.indexOf("["));
$( "#selectfundsname1" ).val( labels );
$( "#selectfundscode1" ).val( ui.item.value );
return false;
}
});
}
$("#selectfundsname1").autocomplete({ //提示
minLength: 0,
contentType : 'application/x-www-form-urlencoded; charset=utf-8',
source:function(request,response){
$.ajax({
url:"/fund/supermarket/tishi1.do",
data:"keywords="+$("#selectfundsname1").val(),
dataType:"json",
type:"post",
success:function(data){
response($.map(data.selectFundInfos, function(item) {
return { label:item.fundname, value: item.fundcode };
// lable为显示值:value为实际值
}));
}
});
},
focus: function( event, ui ) {
return false;
},
select: function( event, ui ) {
var s=ui.item.label;
var labels=s.substring(0,s.indexOf("["));
$( "#selectfundsname1" ).val( labels );
$( "#selectfundscode1" ).val( ui.item.value );
return false;
}
});
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询