Как сделать autocomplete с api travelpayouts
Нужно сделать autocomplete c django, есть такой код:
{% load static %}
<html>
<head>
<title>Autocomplete input suggestion using Python and Flask</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<!--<script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>-->
<script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" crossorigin="anonymous"></script>
<script>
$(function() {
$("#searchBox").autocomplete({
source : function(request, response) {
$.ajax({
url: "http://api.travelpayouts.com/data/ru/airports.json",
dataType: "json",
data: {
searchText: request.term
},
success: function (data) {
response($.map(data.employees, function (item) {
return {
label: item.name,
value: item.id
};
}));
}
});
},
minLength : 2
});
});
</script>
</head>
<body>
<div style="width: 600px; margin: auto;">
<h2>Autocomplete input suggestion using Python and Flask</h2>
<p style="width: 560px; margin: auto;">
<label>Search Here</label> <input type="text" name="search" id="searchBox"/>
</p>
</div>
</body>```
[![Ошибки][1]][1]
[1]: https://i.stack.imgur.com/9OKho.png