 <p>If you're using smarty 3, just remove the {literal} tag and it should work fine. If not, and you don't want to be opening and closing literal tags, declare all the variables you need outside the literal section ie:</p> <pre><code>&lt;script&gt; var video_link = "{$video_link}"; {literal} function postlike() {... video : video_link </code></pre>