title: res.redirect from POST
body: <p>For some reason I cant redirect to /blog once my login is completed.  In my login controller I have the following.</p>
  
  <pre><code>module.exports = {
  
      post: function(req, res) {
           var login = req.body['login'];                      
  
           if (login &amp;&amp; req.body['login']['password'] == "password") {
              console.log('Granted access');
              res.send({redirect: '/blog'});
  
           }
  
           else {
               console.log('wrong password');
               res.redirect('back');
  
           }
  
      }
  
  };
  </code></pre>
  
  <p>The jquery ajax</p>
  
  <pre><code>$(document).ready -&gt;
  
      $('#login-button').click () -&gt;
  
          $.ajax
              url: '/login'
              type: 'POST'
              data: $('#Password').serialize()
              dataType: 'json'
              success: (data, textStatus, jqXHR) -&gt;
                  if typeof data.redirect == 'string'
                      window.location = data.redirect
  </code></pre>
  
  <p>updated to working code</p>