title: How do I pass variable from a Jade template file to a Javascript file?
body: <p>Im very new to Node.js and trying to get my head round few things.How do I pass variable from a Jade template file to a JS file? </p>
  
  <p>I have got this line of code in my server.js file</p>
  
  <pre><code>res.render("aws.jade", {data : JSON.stringify({'val' : 'This is a Test'})});
  </code></pre>
  
  <p>Basically Im just trying to get values in <strong>data</strong> to aws.jade template file</p>
  
  <p>And this is aws.jade</p>
  
  <pre><code>html
      head
         script(type='text/javascript')
              var data = !{data}
          link(rel='stylesheet', href='/stylesheets/style.css')
      body
          title Title
          h1 Heading
          #div.test
  </code></pre>
  
  <p>I keep getting this error in the Firebug console:</p>
  
  <pre><code>&lt;var&gt;data = {"val":"This is a Test"}&lt;/var&gt;
  </code></pre>
  
  <p>Could someone please explain as to why this is happening and a way for me to pass variable from a Jade template file to a JS file?</p>
  
  <p>Thank You</p>