I'm trying to save model with this code:
this.model.save({},
{
success: function (model, response) {
alert("ok");
},
error: function (model, response) {
alert("error");
}
});
I catch the error callback. But my REST API returns a 200 status:
Content-Length:0
Content-Type:application/json
Status code:200
On the server side I have following code:
@RequestMapping(value = "{id}/image/{type}", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public void uploadImage(..) {
response.setStatus(HttpStatus.OK.value());
response.setContentType("application/json");
}
Why backbone.js call error callback instead success?