Backbone model.save() not calling either error or success callbacks

后端 未结 4 1886
走了就别回头了
走了就别回头了 2020-12-05 06:13

I\'m trying to update a record in DB so I\'m defining model with data and calling .save() method. The PUT request is triggered and the database entry is updated. The problem

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 07:06

    While searching on this, I first landed on this SO thread which did not work for me, but seemed to work for other, later on I bumped into this link, where some one had tried null instead of {} as the first parameter.

    this.model.save(null, {
        success: function (model, response) {
            console.log("success");
        },
        error: function (model, response) {
            console.log("error");
        }
    });
    

    so, this worked for me. Hope this helps you too.

提交回复
热议问题