Skip to content
Advertisement

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

JavaScript

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:

JavaScript

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.

Advertisement

Answer

You need to build the “flight” object differently; there’s really no need for the “$FlightSegment” variable.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement