title: Send handlebars data to client-side javascript
body: <p>I am building a node.js application and I'm using handlebars. I wanted to check if there's a way for me to send data defined in a handlebars template to client side javascript to be used in calculations. For example, here is my controller:</p>
  
  <pre><code>module.exports = function (req, res) {
  
      var projectId = req.params.id;
      var context = {
          cost: 500,
          revenue: 1000, 
      }
  
      res.render('../views/reports', context)
  };
  </code></pre>
  
  <p>On the client-side javascript file, I want to do something like:</p>
  
  <pre><code>$(document).ready(function(context) {
      var profit = context.revenue - context.cost;
  });
  </code></pre>
  
  <p>I'm not sure how to pass the context into the client side javascript.</p>
  
  <p>Can someone help?</p>
  
  <p>Thanks!</p>