This is what I have tried so far and it works fine without a custom template. However I need to show some more data, such as images etc., within the search result. How can I call a custom template along with AJAX?
<input type="text" class="site-search" name="search">
var path = "{{ route('site-search') }}";
$('input.site-search').typeahead({
hint: true,
highlight: true,
display: 'value',
source: function (query, process) {
return $.get(path, { query: query }, function (data) {
return process(data);
});
}
});
See the docs. Just make your template function and use
|raw
modifier to show clean, non-escaped html.