title: Passing variable from Server side to client side JavaScript Node.js
body: <p>index.js</p>
  
  <pre><code>var outputFilename = 'C:/askhere/public/javascripts/data.json';
                      fs.writeFile( outputFilename, JSON.stringify(json_obj), "utf8", function(err) {
                          if(err) {
                              console.log(err);
                          } else {
                              console.log("Jobs Data updated in " + outputFilename + " file.");
                          }
                      });
  res.render('graph',{uname:req.session.userName,gdata:JSON.stringify(json_obj)});
  </code></pre>
  
  <p>graph.ejs</p>
  
  <pre><code>                    &lt;script type="text/javascript" src="/javascripts/graph.js"&gt;
  
                      &lt;/script&gt;
  </code></pre>
  
  <p>graph.js</p>
  
  <pre><code>            /*var data = [{"label":"1990", "value":16},
      {"label":"1991", "value":56},
      {"label":"1995", "value":16},
  ];    var data;
      d3.json("data.json", function(error, json) {
          if (error) {return console.log(error);}
          else {data = json; console.log("data updated in graph.js");}
      });
  </code></pre>
  
  <p>Now this code getting "data" update from server in graph.js file but i cant see result in graph.ejs file</p>