Backbone async

I started learning how to use Backbone.js, a front-end library for managing the structure of your web application. While it seems Backbone is on the decline, I still decided to go with it and do at least one project with it because I heard it was an easier place to get started.

Backbone lets you separates your data from the DOM and helps connect your API over a RESTful JSON interface. My motivation for learning Backbone was to create a single-page web application. My previous project loaded every page every time there was an action. It seems a lot of modern web sites are single-page web apps. The JSON interface sends JSON to the server and receives JSON and only updates that section that is relevant. This allows for more fluidity and I feel like an overall better user experience.

In certain parts, I kept getting errors when using fetch or create. After creating or fetching, I would try to render it, but I would get an error saying I was trying to render undefined. It turns out, that I was trying to render these objects before the previous function was completed. This issue could be solved by passing the secondary action I was trying to complete as a callback in the success attribute.

#second attempt
app.scoreList.create(this.ratedIdea(idea, score), {success: function(){
  app.ratedIdeaList.fetch({wait:true, reset:true});