Last active
August 29, 2015 14:01
-
-
Save chadwilcomb/67428f87ec07d1a2e1e6 to your computer and use it in GitHub Desktop.
Backbone.js: have server return partial view after model.save event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
save: function () { | |
var _this = this; | |
this.model.save(null, { | |
error: function (model, response, options) { | |
//Backbone save goes to error if response is not JSON | |
if (response.status === 200) { | |
//check response code and then manually render view with response HTML | |
_this.$el.html(response.responseText); | |
} | |
} | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment