I have a situation where I need to save the Backbone model, and then its success iterating through the collection and saving them, and then at each of these successes iterating through the other collection and saving them, and then after they are all executed AJAX request . This is what I have:
backboneModel.save( {}, { wait: true, success: function (model1, response1) { $.each(backboneCollection1.models, function () { this.save( {}, { wait: true, success: function (model2, response2) { $.each(backboneCollection2.models, function () { this.save( {}, { wait: true, success: function (model2, response2) {
Does anyone have any suggestions on where to execute this AJAX request so that it runs only once after all the base models have been stored on the server?
Chris source share