This is stumping me... whenever I do model.destroy() the request goes through successfully and the model gets deleted.
However, whenever I try to model.save() or collection.create(this.model) no requests are being made to the server for some reason.
Trying to see if there are any errors with:
this.collection.create({ title: 'some title' }, {
success: function (model) {
console.log(model);
},
error: function (model, response) {
console.log(response);
}
});
And all I get is this in console:
Object { readyState=0, status=0, statusText="error"}
My models:
Stuff.Model = Backbone.Model.extend({
urlRoot: 'http://domain.com/api/stuff'
});
Stuff.Collection = Backbone.Collection.extend({
model: Stuff.Model,
url: 'http://domain.com/api/stuff'
});
Any idea on why this might be happening? Thanks
*Update -- just checked console on Chrome and it says:
XMLHttpRequest cannot load http://domain.com/api/stuff. Request header field Content-Type is not allowed by Access-Control-Allow-Headers.