得到结果后做一些事情 jQuery UI 自动完成
我是盲目的还是在 jQuery UI Autocompelete 中获得结果后无法执行某些操作?
这就是我正在尝试的:用户开始在输入字段中写入地址,自动完成会获取建议,并且自动完成显示的所有这些建议应该显示在地图上。我可以在地图上显示部分,但是当自动完成获取结果时如何触发它?我看到有“选择”事件等,但没有“搜索建议已准备好”事件。那我该怎么办呢?任何建议。
现在的 js:
$("form#search .address").autocomplete({
source: function( request, response ) {
$.ajax({
url: addresses.php,
dataType: "json",
data: {term: request.term},
success: function(data) {
response($.map(data, function(item) {
return {
label: item.addy
};
}));
}
});
},
minLength: 2
});
所有帮助均已得到认可。谢谢你!
Am I blind or is there not possibility to do something after gettings results in jQuery UI Autocompelete?
This what I'm trying: user starts writing address in input field, Autocomplete gets suggestions and all those suggestions what the Autocomplete shows, should be showed on a map. The showing on map part I can do but how can I trigger it when the Autocomplete gets results? I saw there was "Select"-event and such but no "search-suggestions-are-ready"-event. How should I do it then? Any suggestions.
The js now:
$("form#search .address").autocomplete({
source: function( request, response ) {
$.ajax({
url: addresses.php,
dataType: "json",
data: {term: request.term},
success: function(data) {
response($.map(data, function(item) {
return {
label: item.addy
};
}));
}
});
},
minLength: 2
});
All help appcreciated. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
open
事件,它在打开建议窗口时发生(意味着结果已经给出)。Try the
open
event, it occurs when the suggestion window is opened (meaning the results were already given).