I am currently working on a small Restful CRUD app, the frontend for which is written using the backbone.js framework. I understand most of the internals of how this application is working and its MVC structure, however I have several models, which when they are being edited, redirect unnecessarily. Perhaps a code example will help:
updateUser: function () {
this.model.save(null, {
success: function (model) {
app.navigate('userlist', {trigger: true, replace: true});
utils.showSuccessAutoClose("User", "The user has been updated.");
},
error : function (model, fail, xhr) {
utils.showCommsError(fail.status, fail.responseText);
}
});
}
The issue that I have is when this update method fails (when the server returns a 500 server for whatever reason), the page redirects from the current page
/pages/admin.jsp#useradd
to /pages/admin.jsp
for no reason, even if all of the code in the error handler commented out.
What is causing this redirect to happen?