I created a list, but I have problems saving the model.
createOnEnter: function(e) { var self = this; var input = this.$("#new-title"); var input2 = this.$("#new-content"); //var msg = this.model.isNew() ? 'Successfully created!' : "Saved!"; if (!input || e.keyCode != 13) return; Mynote.save({title: this.input.val(), content: this.input2.val() }, { success: function(model, resp) { new LibraryView.Notice({message: msg}); self.model = model; self.render(); self.delegateEvents(); Backbone.history.saveLocation('mynotes/' + model.id); }, error: function() { new LibraryView.error(); } }); return false; },
Did I do it right? is it in the same view for the set or the "index" url or do I need to specify a different route for the new model?
source share