title: ReferenceError: window is not defined after Ajax call trying to redirect the user
body: <p>I am new to express with EJS.</p>
  
  <p>I tried making a ajax post request for submitting to the values to the DB using.</p>
  
  <pre><code> $.ajax({
      type: 'POST',
      url: '/register',
      data: user,
      success: function(data){
          console.log(data);
          return data;
      }
    });
  
    return false;
  </code></pre>
  
  <p>This call is successful and after which the control goes to the calling function </p>
  
  <pre><code>var sess;
  
    app.post('/register',urlencodedParser,function(req,res){
      sess=req.session;
      var newUsr=Users(req.body).save(function(err,data){
        if(err) throw err;
        console.log(" back from ajax with data :::; " + data);
  
        console.log("step1 cleared");
        sess.registered=true;
  
      });
      console.log("step2 cleared");
      location.window.href = '/index2';
    });
  </code></pre>
  
  <p>I want the user to see the index page once the registration is successful, but I am getting the below error.</p>
  
  <pre><code>ReferenceError: location is not defined
  </code></pre>
  
  <p>I think location object is not there in node, thus this error, but again I dont know how to fix this issue, please suggest</p>