title: Passing PHP array using json_encode method into external Javascript function gives result as 'undefined'
body: <p>I have searched for that, i got some ideas from following site also.
  <a href="https://stackoverflow.com/questions/13116604/passing-php-array-into-external-javascript-function-as-array">Passing PHP array into external Javascript function as array</a>
  My sample code is below:</p>
  
  <pre><code> &lt;?php $array_sample = array("c1","c2"); $newArray = json_encode($array_sample); ?&gt;
   &lt;INPUT type="button" value="Php Array" onclick="Test(&lt;?php echo $newArray ?&gt;)" /&gt;
   &lt;script language="javascript"&gt; function Test(test_arr){    alert(test_arr); }&lt;/script&gt;
  </code></pre>
  
  <p>For above code, I am getting <code>undefined</code> as <code>alert message</code>.
  Any Help would be appreciated.</p>