title: Using a smarty array in javascript
body: <p>I am trying to use smarty in javascript.</p>
  
  <p>Here is my complete code of the .php and .tpl :</p>
  
  <p>.Php</p>
  
  <pre><code>&lt;?php
  
  $_CRUMBS-&gt;Add("User false logs", "/users/user false logs/");
  
  
  $ufl = $_DB-&gt;queryRaw("SELECT `user_id` ,`firstname`,`lastname` FROM `employees`");
  
  while ($row = $ufl-&gt;next_assoc()) {
  $results[] = $row;
  }
  
  $smarty-&gt;assign("ufl",$results);
  $smarty-&gt;TDisplay("users/backend_users.tpl", "MDPI Backend | Backend Users", "general-content.tpl");
  
  ?&gt;
  </code></pre>
  
  <p>.tpl</p>
  
  <pre><code>&lt;h1&gt;Create Backend Users&lt;/h1&gt;
  
  
  
  &lt;script&gt;
  $(function() {
      var availableTags = [
          {foreach from=$ufl item=uflItem}
              &lt;tr&gt;
                  &lt;td&gt;{$uflItem['firstname']}&lt;/td&gt;
              &lt;/tr&gt;
      {/foreach}
      ];
      $( "#tags" ).autocomplete({
          source: availableTags
      });
  });
  &lt;/script&gt;
  
  
  &lt;div class="demo"&gt;
  &lt;div class="ui-widget"&gt;
  &lt;label for="tags"&gt;Tags: &lt;/label&gt;
  &lt;input id="tags"&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;&lt;!-- End demo --&gt;
  </code></pre>
  
  <p>But I have errors there. I have tryed wit literal but nothing changed. Thank you.</p>