I’m trying to bind error and success callback for Backbone’s save method (which uses jquery .ajax under the hood), and I’m getting the error callback fired, although I return 201. Here is full info on my response:
POST http://localhost:8080/ws/company 201 Created
Content-Type application/json;charset=UTF-8
the response itself contains my saved entity’s JSON representation. What do I do wrong?
Turn’s out that because of failed backbone.js validation it sent me to error. The question is, why backbone.js won’t return false on model.save and persists the invalid state, but it’s not within the scope of this questions.
Turns out that my local backbone.js somehow missed the following lines:
Now I don’t know how is it possible, but it’s true.
https://github.com/documentcloud/backbone/issues/1906