@ilya_user I think you can do this by using the updater function provided by the typeahead library.
For example:
<script type="text/javascript">
var route = "{{ url('autocomplete-search') }}";
$('#head_id').typeahead({
source: function (query, process) {
return $.get(route, {
query: query
}, function (data) {
return process(data);
});
},
updater: function(item) {
return item.id; // this sets the value of the input field to the ID of the selected item
}
});
</script>