passing database values to javascript under symfony?

I can’t add a comment yet!

I hope this article can help you

creating templates

// php
return $this->render('xx/xx/xx.html.twig', [
    'data' => [
        'name' => 'davis',
        'age' => 18,
        'sex' => 'M'
// twig
<select id="ice-cream-flavors">
    {% for column, value in data %}
        <option value="{{ value }}">
    {% endfor %}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top