title: Variables between HTML Client and Node.js Server
body: <p>I just wanna to pass variables from a HTML page to a node js and perform some calculations on the data and get it back to HTML using ejs
  After installing ejs :</p>
  
  <pre><code>npm install ejs
  </code></pre>
  
  <p>I'm trying to pass this variable temp with value 50 "HTML Page":</p>
  
  <pre><code>&lt;html&gt;
     &lt;head&gt;
     &lt;/head&gt;
  &lt;body&gt;
  My temperature: &lt;%= temp=50 %&gt;
  Temp + 10 : &lt;%= total %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and my nodejs server.js:</p>
  
  <pre><code>var http = require('http');
  var ejs = require('ejs');
  var fs = require('fs');
  
  http.createServer(function(req,res) {
    res.writeHead(200, {'Content-Type': 'text/html'});
  
    //since we are in a request handler function
    //we're using readFile instead of readFileSync
    fs.readFile('index.html', 'utf-8', function(err, content) {
      if (err) {
        res.end('error occurred');
        return;
      }
      var temp;  //here you assign temp variable with needed value
      var total = temp+10;
      var renderedHtml = ejs.render(content, {temp: temp, total:total});  //get redered HTML code
      res.end(renderedHtml);
    });
  }).listen(8080);
  </code></pre>
  
  <p>Any help would be appreciated 
  Thanks in advance.</p>