title: how to use symfony controller variables in frontend js?
body: <p>Say I have a controller like this:</p>
  
  <pre><code>public function showAction(Request $request, $id, $context = array())
  {
      $url = $this-&gt;getPlayUrl($id, $context);
  
      //some code here}
  </code></pre>
  
  <p>I want to use the variable $url in a frontend js file like this :</p>
  
  <pre><code>var html = '&lt;iframe src=\''+ url +'\' name=\'viewerIframe\' id=\'viewerIframe\' width=\'100%\'allowfullscreen webkitallowfullscreen height=\'100%\' style=\'border:0px\'&gt;&lt;/iframe&gt;';
  </code></pre>
  
  <p>How am I supposed to make this happen? For the code above ,it gave me 'undefined url' error.</p>
  
  <p>Thank you.</p>