我正在尝试用api.ai连接数据库以为我的机器人添加问题建议,但找不到任何示例,我需要javascript或python中的代码示例
find my example please
html
<body>
<input id="myText" />
</body>
jquery
$(function () {
var getData = function (request, response) {
$.getJSON(
"http://gd.geobytes.com/AutoCompleteCity?callback=?&q=" + request.term,
function (data) {
response(data);
});
};
var selectItem = function (event, ui) {
$("#myText").val(ui.item.value);
return false;
}
$("#myText").autocomplete({
source: getData,
select: selectItem,
minLength: 4,
change: function() {
$("#myText").val("").css("display", 2);
}
});
});
with auto comp api: https://autocompleteapi.com/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.