I am using typehead mixed with prefecth for the auto completion of a field called rut, at the moment of requesting information from a JSON file if I use the route calling it in the following way:
prefetch: '/ providers / json'
It does not throw me any inconvenience, whereas if I try to respect the blade laravel syntax by calling the url in the following way
prefetch: '{{url (' / providers / json ')}}'
It does not interact with the route, which is defined within my web.php file
This is the code of the JavaScript part
<script>
$(document).ready(function(){
var providers = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '{{url('/providers/json')}}'
});
$('#rut').typeahead({
hint: true,
highlight: true,
minLength: 3
},
{
name: 'providers',
source: providers
})
});
</script>
Note: I use the version of laravel 5.6