How do I access a Twig variable through JavaScript?

1

I'm creating an autocomplete to use on my system and I'm using Twig ...

My script is very simple and with some searches on the internet, that's what I got to get:

<script type="text/javascript">
    var nomes = {{ usuarios | json_encode | raw }};
        $( "#busca" ).autocomplete({
            minLength: 1,
            source: nomes
        });
</script>
    
asked by anonymous 05.04.2017 / 02:45

0 answers