• I have a piece of PHP code working fine and dandy but I need to pass an array to JS code for the next step.

    If I put a script code at the end of the PHP code I can get the array passed to that JS script but it does not pass if that script is a Code Manager LS piece of code.

    Here’s the array passing script. I use script tags after the ?> in the PHP piece of code but not in the JS piece of code.

    <script>
         var passArray = <?php echo '["' . implode('", "', $php_array) . '"]' ?>;
         document.write(passedArray[0]);
    </script>

    Thanks.

  • The topic ‘Pass array PHP code to JS code’ is closed to new replies.