Model data not recieving on Server on put call in

2019-08-22 21:40发布

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();
                }

            }

1条回答
Emotional °昔
2楼-- · 2019-08-22 22:17

after a lot of debugging and untiring effort I figured out problem. There was a problem of mapping between server side model and client side model.

查看更多
登录 后发表回答