How to access a Twig variable via Javascript?

Asked

Viewed 256 times

1

I am creating an autocomplete to use in my system and I am using Twig...

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

<script type="text/javascript">
    var nomes = {{ usuarios | json_encode | raw }};
        $( "#busca" ).autocomplete({
            minLength: 1,
            source: nomes
        });
</script>
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.