0

I want to set the value of my twig variable from an external js file.

I have this code in twig:

{% set items = null }
{% include "list.twig" with { itemList: items} %}

And I want to set the items from an external Js. How can I update the value of the items from Js ?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Zahra Talebi
  • 675
  • 4
  • 11
  • 26
  • 2
    That's not possible: Twig is running on the server, JS in your browser. You could refactor your application to write this list using JS – Nico Haase Jul 05 '23 at 13:05
  • Related: [Difference between client- and serverside](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – DarkBee Jul 05 '23 at 13:54

0 Answers0