, ajax, . , , , ; .., JavaScript .
, jquery ajax :
model.save({ error:function...
function requiresLogin(req, res, next) {
if(req.session.user) {
next();
} else {
res.send("Unauthorized", 403);
}
}
Client
error: function(resp, status, xhr)...
if(resp.status === 403) {
window.location = '/sessions/new';
}
, . googling ajax, ,