title: How to Pass the Controller Data to JS File in CakePHP 3.0
body: <p>In CakePHP 2.0, I've used the link below to pass controller data to a js file. However, I can longer use this method anymore as CakePHP 3.0 has removed js helper.</p>
  
  <p>Is there a new technique for me to pass the controller data to a js file or alternative method beside using js helper with the link below?</p>
  
  <p><a href="http://www.php-dev-zone.com/2014/01/how-to-pass-controller-data-to-js-file.html" rel="nofollow">http://www.php-dev-zone.com/2014/01/how-to-pass-controller-data-to-js-file.html</a></p>
  
  <p>Relevant code:</p>
  
  <pre><code>public function beforeRender()
  {
      // We are Setting the jsvariables array which holds the
      // variables that will be used in js files.
      $this-&gt;set('jsVars', $this-&gt;_jsvariables);
  }
  </code></pre>
  
  
  
  <pre><code>&lt;?php echo $this-&gt;Html-&gt;scriptBlock('var jsVars = '.$this-&gt;Js-&gt;object($jsVars).';'); ?&gt;
  </code></pre>