Having trouble converting php array to javascript?

  • Thread starter Thread starter butchtroll
  • Start date Start date
B

butchtroll

Guest
I am using the following to convert a php array to javascript.

var TextsArray = new Array(<?php

foreach($TextsArray as $Text)

{

echo "'$Text',";

}

?>);

The output of this statement is:

var TextsArray = new Array('Your Text Here',);

This generated line creates a syntax error, is it because of the single quotes???
 
Back
Top