link name link autocomplete搜索
我想单击搜索框中的名称和该人的打开个人资料。如何在此项目上添加链接。firstName。我对用户配置文件的路线是'/user/{id}'..
这是我的JavaScript代码,用于autocomplete
<script type="text/javascript">
$('.livesearch').select2({
placeholder: 'Search users',
ajax: {
url: '/master/autocomplete',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: $.map(data, function (item) {
return {
text: item.firstname+' '+item.lastname,
id: item.id,
}
})
};
},
cache: true,
}
});
</script>
<< img src =“ https://i.sstatic.net/bvrsb.png” alt =“在此处输入图像说明”>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不知道它是否有效,但是您可以尝试添加标签,而不是像
Don't know if it works but you can try adding a tag instead of text like
您可以尝试在选择选项时执行功能
u can try executing a function on selecting the option
有答案...我希望它对某人有帮助。
There is answer... I hope so that it can be helpful to someone..