You might have to json_encode
the array, try this:
<script>
$(document).ready(function(){
var test = {{ testArray|json_encode|raw }};
});
</script>
More Related Contents:
- How to get the value from and save to Database in php
- Decoding JSON in Twig
- How to access dynamic variable names in twig?
- How to display string that contains HTML in twig template?
- Accessing session from TWIG template
- The CSRF token is invalid. Please try to resubmit the form
- Compile Error: Cannot use isset() on the result of an expression
- What is the best way to notify a user after an access_control rule redirects?
- How to render a DateTime object in a Twig template
- How can I use break or continue within for loop in Twig template?
- Set value of single object in multidimensional array in twig template
- How to make form_rest() not display a field with Symfony2?
- Symfony 2 load different template depending on user agent properties
- Use custom delimiters in the current Twig template
- How to render content from string/database with twig? [duplicate]
- do not include AcmeDemoBundle using symfony installer
- Symfony 3, Guard & Handlers
- Calling a php script at the end of a js script
- PHP json_encode encoding numbers as strings
- Check if cookies are enabled
- Creating jQuery AJAX requests to a PHP function
- How to check for null in Twig?
- How can I block direct access to my JavaScript files?
- Is there a built-in function or plugin to handle date formatting in JavaScript?
- How to add anchor tag to a URL from text input
- Regex for names with special characters (Unicode)
- How to get exact browser name and version?
- Regular expression for a string that must contain minimum 14 characters, where at minimum 2 are numbers, and at minimum 6 are letters
- uploading a file via ajax with php
- Conflict on Template of Twig and Vue.js