Skip to content

Instantly share code, notes, and snippets.

@tblobaum
Created November 3, 2011 12:31
Show Gist options
  • Save tblobaum/1336381 to your computer and use it in GitHub Desktop.
Save tblobaum/1336381 to your computer and use it in GitHub Desktop.
app.all('/user', function (req, res, next) {
User.findOne(req.params, function (e, user) {
if (!user) var user = new User(req.params)
var here = req.sessionId + '#/user'
nQuery(here).on('ready', function ($) {
$('.form').live('submit', function () {
$('.form').serialize(function (data) {
//update the user with the form data
user.update($.parseQueryString(data))
$('.messages').append('user updated.')
})
})
})
res.render('user', { locals: { user: user }})
res.end()
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment