Skip to content

Instantly share code, notes, and snippets.

Created January 12, 2011 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/777006 to your computer and use it in GitHub Desktop.
Save anonymous/777006 to your computer and use it in GitHub Desktop.
this.post('#/reply', function (context) {
var fields = this.params, doc = {};
doc.content = fields['post'];
doc.datetime = new Date.now();
doc.thread_id = fields['thread_id'];
doc.type = 'post';
doc.user_id = 'chapel';
console.log(doc);
db.saveDoc(doc, {
success: function() {
this.redirect('#/thread/'+fields.thread_id);
},
error: function() {
alert('Error saving document.');
this.redirect('#/thread/'+fields.thread_id);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment