I want to update a backbone model so that I can set the data of a backbone model and then update it on the express backend but so far I have not been successful. I have checked the urls on the routes and it is correct but so far it has not been sent to the backend.
Here is the update part of the code.
update: function() {
this.$('#noteParent .note-editable').prop('contenteditable', false);
this.$('#aboutParent .note-editable').prop('contenteditable', false);
this.$('#update').prop('disabled', true);
var notes = this.$('#noteParent .note-editable').html();
var about = this.$('#aboutParent .note-editable').html();
var username = $('#data-username').text();
app.url = "/update-usernotes";
this.model.set({
username: username,
email: app.email,
about: about,
editorNote: notes
});
}
Is the set method the right method to update the model ? Also on doing console.log(this.model) right before this.model.set i get the updated model, so how can I send the updates to the backend ?