[SOLVED] SC Blank App Altering Code in <script> tags

I’m echoing some HTML and JS to the browser in a blank app. Excerpts of the code is as follows:

$dump = " <script>

for (var i = 0; i < rows.length; i++){

// please note that rows has been properly initialized with an array of objects prior

var cells = rows[i].split(’ ');

</script>";

echo $dump;

When this is run, I keep getting a console log error such as “unable to call member of undefined” and the source shows this

var cells = rows.split(’ ');

i.e. it drops the index variable i and of course rows is not the object so the split function cannot be called.

I also notice when I run the blank app, it seems to think i is an SC variable and prompts for the value (i.e it also places “i” in the Global Variables section of the development area).

I have tried using other variable names and also using multi line echo <<< but I get same results.

Has anyone encountered and fixed something like this?

Hi…
Try This
$dump = " <script>

for (var i = 0; i < rows.length; i++){

// please note that rows has been properly initialized with an array of objects prior

var cells = rows[i].split(’ ');

</script>";

Thank you, works.

Change Title to [SOLVED]