我使用选择的Ajax选择选择
我的情况是下一个......我有这个数据
[{name: "Name to show", property: "Using this field by search", id: 1},
{name: "Name to show", property: "Using this field by search", id: 2} ]
如何按字段搜索,并在html中显示其他文字?
答案 0 :(得分:0)
你只需要这样做
$('.chosen-ajax').ajaxChosen({
type: "GET",
url: "my_path",
dataType: 'json'
}, function(data){
var result = [];
for (var i = data.length - 1; i >= 0; i--) {
var value = data[i];
result.push({"value" : value.id, "search_text" : value.property ,text: value.name})
}
return result;
}
)
重要的: 您必须添加“search_text”