title: AJAX call with nodeJS and express successful, but not displaying data
body: <p>I have recently migrated from a codeigniter framework, to a nodejs with an express framework. Our codeigniter site had a lot of JS as it was, and we made a lot of AJAX calls because it is a single page app. We are messing around with node and express now, and I cannot get a simple AJAX call to function. It could be a lack of understanding of node, it could be something else. We are using openshift to host. We are using hogan-express as a template.</p>
  
  <p>server.js</p>
  
  <pre><code>var express = require('express');
  var fs      = require('fs');
  var http    = require('http');
  var path    = require('path');
  
  var SampleApp = function() {
  
  
  var self = this;
  
  self.initializeServer = function() {
      self.app = module.exports = express();
  
      self.app.configure(function() {
          self.app.set('views', __dirname + '/views');
          self.app.set('view engine', 'html');
          self.app.engine('html', require('hogan-express'));
          //self.app.set('layout', 'layout') # use layout.html as the default layout
          self.app.use(express.favicon());
          self.app.use(express.logger('dev'));
          self.app.use(express.bodyParser());
          self.app.use(express.methodOverride());
          self.app.use(express.session());
          self.app.use(self.app.router);
          self.app.use(require('stylus').middleware(__dirname + '/public'));
          self.app.use(express.static(path.join(__dirname, 'public')));
  
  
  
      });
  
   require('./routes');    
  }
  </code></pre>
  
  <p>There is more code in this file, I am only including the relevant code (I think).</p>
  
  <p>Ajax.html</p>
  
  <pre><code>  &lt;div id="button"&gt;
     &lt;button id="testbutton"&gt;Push Me!&lt;/button&gt;
    &lt;/div&gt;
    &lt;div id="populate"&gt;{{title}}&lt;/div&gt;
    &lt;div id="null"&gt;{{&gt;part}}&lt;/div&gt;
  
  
  
  
  &lt;script type='text/javascript'&gt;
  
  $(function(){
      $('#testbutton').click(function (){
          $.ajax({
              url:'/test',
              type: 'POST',
              success: function(result){
                      alert('success!');  
              },
              error: function(){
                  alert("well this is embarassing... if the problem persists please let us know at facebook.com/stembuds");
              }
          });
      });
  });
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>index.js</p>
  
  <pre><code>  app = require('../server');
  
    app.get('/', function(req, res){
      res.render('ajax');  
    });
  
    app.post('/test',  function(req, res){
      console.log('get');
      res.locals = {title: 'Horray'};
      res.render('ajax', {partials:{part:'part'}});
    });
  </code></pre>
  
  <p>part.html</p>
  
  <pre><code>  &lt;p&gt; pass me in!!&lt;/p&gt;
  </code></pre>
  
  <p>So basically what I am trying to do is when the button is clicked I want the ajax call to show a partial view. The way we are going to structure the site is to have one single page, and have the ajax calls render different views based on the buttons that the user clicks. So here is the interesting part: I get the success alert from the ajax call, but the {{title}} and the {{>part}} never show up. However, when I go to the console and click 'network', and then click 'test' (the url to my ajax call), the response shows the divs populated with "Horray" and "pass me in!!". Sorry for the length, and thank you for any information you can provide us. </p>