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 is neither success or error callbacks are called. What could be the cause?
sessionsModel.save({ error: function() { alert('test'); }, success: function () { alert('test'); } });
Edit: Request returns JSON object
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.
Just found similar problem where the issue was solved. You have to put something as first parameter (I put null since my model was already populated with data explicitly) and object with callbacks as second. So something like;
sessionsModel.save(null, {success:function() {} });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With