You don't need to call function for it:
just have an input element:
<input type="text" id="search">
Try this:
$(function(){
$("#search").autocomplete({
source: function(request, response) {
$.ajax({
url: "/bankir/banks_search/",
type: "POST",
dataType: "jsonp",
data: {
term: $("#search").val()
},
success: function(data) {
response($.map(data, function(item) {
return {
label: item.name,
value: item.id
};
}));
}
});
},
minLength: 0,
focus: function(event, ui) {
$("#search").val(ui.item.label);
},
select: function(event, ui) {
window.location = "/bank/" + ui.item.value;
}
});
});