title: Node.js Express: Ajax call from ejs to app.js fetching data render div dynamically
body: <p>I have an express app with node.js that,</p>
  
  <p>1) <code>app.get('/', routes.index)</code> points to my index.ejs.</p>
  
  <p>2) there is a button on my index.ejs. When it is clicked, I want to call the dataGrab function in app.js to retrieve the data remotely and display in index.ejs as a <code>&lt;table&gt;</code> dynamically.</p>
  
  <p>in my app.js</p>
  
  <pre><code>var data=[];
  grab = function() {
     .... grab data remotely and push to data[]
  }
  </code></pre>
  
  <p>As the button actually sits on the client side, if I want to call grab() in app.js to populate the data[] and use it to render a table on index.ejs, is using ajax the only way? If yes, could u share a simple code sample?</p>
  
  <p>Regards
  Hammer</p>