title: Can't get jQuery's ajaxSuccess() to work
body: <p>I'm writing a very simple todo app in Rails.</p>
  
  <p>View: </p>
  
  <pre><code>h2 Your todos
  ul#todo_list
    = render @todos
  hr
    h4 Add new
    = form_for(Todo.new, url: {action: 'create'}, remote: true) do |form|
      = form.text_field :text
      = form.submit 'Add'
  </code></pre>
  
  <p>CoffeeScript:</p>
  
  <pre><code>class Todo
    constructor: () -&gt;
      @bindEvents()
  
    bindEvents: () =&gt;
      console.log 'test1'
      $(document).ajaxSuccess(@onAjaxSuccess)
  
    onAjaxSuccess: (event, xhr, settings) -&gt;
      console.log 'test2'
      $('#todo_list').append(xhr)
  
    @isPresent: (element_id) -&gt;
      $("##{element_id}").length &gt; 0
  
  $(()-&gt;
    new Todo if Todo.isPresent('todos')
  )
  </code></pre>
  
  <p>When I create a new todo, <code>test1</code> is printed in the console. I get a proper 200 response. The <code>@onAjaxSuccess()</code> method is not fired (<code>test2</code> is not printed). Why?</p>
  
  <p>UPDATE:</p>
  
  <p>I've just read that <code>jquery-ujs</code> fires <code>ajax:success</code> event so I have also tried:</p>
  
  <pre><code>bindEvents: () =&gt;
    console.log 'test1'
    $('#new_todo').on('ajax:success', @onAjaxSuccess)
  </code></pre>
  
  <p>Still doesn't work.</p>