title: Backbone Coffeescript Save Success Function
body: <p>I'm trying to implement a success function inside a save call in my backbone basic survey app I'm creating to help me learn backbone. After the user finishes the last question a new completion is created. My server only allows a user to take the survey once, so when the user tries to submit the same completion a 500 Internal Error is returned noting the completion was not created.</p>
  
  <p>The problem is that the success function seems to be getting called both when the response is 201 and when it's 500. Any idea how I need to change my save function such that the success is only called when the response is 201 and not 500?</p>
  
  <pre><code>updateQuestion: -&gt;
      if @questionNumber &lt; @questionLimit
        @questionNumber += 1
        $("#container").html(@render().el)
        choice = new SurveyMe.Models.Choice
        choice.save(
          choice:
            appuser_id: Cookie.get('survey_user_id')
            question_id: @model.get('questions')[@questionNumber]["id"]
            answer_id: "4"
        )
        @renderQuestion()
      else
        completion = new SurveyMe.Models.Completion
        completion.save(
          {
          completion:
            survey_id: @model.get('id')
            appuser_id: Cookie.get('survey_user_id')
          },
          success: 
            @model.save(
              number_taken: @model.get('number_taken') + 1
            )
        )
        Backbone.history.navigate("surveys",trigger: true)
  </code></pre>