I am trying to save a model to the server from backbone.js. My problem is when I make a post call, all the model values are recieved on server successfully, but I make a put call on the server after setting model id. It makes call sucessfully but I recived not model values on the server although model is filled with values on the client side. I am using follwing code. Please guide
var isAdd = false;
if (e.insuranceId != 0) {
this.model.id = e.insuranceId;
isAdd = false;
} else
isAdd = true;
this.model.set('PatientId', this.options.patientId);
this.model.save({}, {
success: function (model, resp) {
console.log('success');
if(isAdd)
self.model.set(self.model.defaults);
self.insuranceId = model.attributes.PatientInsuranceId;;
self.saveFrontImageDB();
self.showConfirmation();
}
}