Skip to content
Advertisement

Tag: twig

Get an ID just created without reloading the page

Here is a div that I append in AJAX with a script (at the bottom of the TWIG file) : If I then click on the freshly appended button, it returns an error because the ID “vote.id” is still 0 until I reload the page and the ID gets found… Is there a way to trigger the for loop without

how to keep double quotes in twig?

I have a json array that I pass to the twig template, but the double quotes in the array have been causing trouble, my json array is like this: in twig template, I print it out like this: I expect it to be attrs: [“a”, “b”], however, what gets output is attrs: ["a", "b"], I tried attrs: {{ arr|e(‘js’) }},

Pushing an array in js doesn’t look to work properly

I have this array from my controller which is passed to my twig where I execute the below code to parse it into a js array: The problem is that $flight.length returns 4 instead of 2, the ReturnFlightSegmentDetails is considered like an object instead to be an attribute for a flight. Answer You need to build the “flight” object differently;

Advertisement