jquery自动补全-json

//异步查询商户信息
$("#keyword").autocomplete("merchant_select.jhtml", {
dataType: "json",
max: 20,
width: 600,
scrollHeight: 300,
parse: function(data) {
return $.map(data, function(item) {
return {
data: item,
value: item.name,
result: item.name
}
});
},
formatItem: function(row, i, max) {
return "商户名称:"+row.name+"     |商户电话:"+row.telephone+"     |用户名:"+row.username;
},
formatMatch: function(row, i, max) {
return row.name + row.telephone;
        },
        formatResult: function(row, i, max) {
return row.name + row.telephone;
}
}).result(function(event, row, formatted) {//选中触发的方法
$("#merchantPageId").val(row.id);
$("#keywordCountname").html("${message("MerchantForegift.entering.merchant.name")}:"+row.name);
$("#keywordCountnumber").html("${message("MerchantForegift.entering.merchant.number")}:"+row.telephone);
$("#keywordCountusername").html("${message("MerchantForegift.entering.merchant.username")}:"+row.username);

});

你可能感兴趣的:(jquery)