title: Jquery bind on 'ajax:success', 'ajax:error' or 'ajax:complete' not executed even though form is submitted
body: <p>In my Jquery <strong>bind</strong> method , <code>'ajax:success', 'ajax:error' or 'ajax:complete'</code> callbacks are not being excuted. The form is being submitted through Ajax and the data is inserted to the database successfully but those callbacks function are not being invoked at all (its simply supposed to show alert pop up inside those callbacks.) I am using Jquery 1.6,Rails 3.1  Here is my code.Thank you in advance. </p>
  
  <p><strong>Form</strong></p>
  
  <pre><code>&lt;%= form_for(resource,:as=&gt;resource_name,:url =&gt; registration_path(resource_name), :html =&gt; {:id =&gt; "sign_up_user"},:remote =&gt; true,:format =&gt; :json) do |f| %&gt;
   &lt;%= devise_error_messages! %&gt;
   &lt;%= f.label :Username %&gt;
   &lt;%= f.text_field :username %&gt;&lt;/p&gt;
   &lt;%= f.label :email %&gt;
   &lt;%= f.text_field :email %&gt;
   &lt;%= f.label :password %&gt;
   &lt;%= f.password_field :password %&gt;
   &lt;%= f.label :password_confirmation %&gt;
   &lt;%= f.password_field :password_confirmation %&gt;
   &lt;%= f.submit "Sign up" ,:id=&gt;"sign-up" %&gt;
  &lt;% end %&gt;      
  </code></pre>
  
  <p><strong>Ajax bind</strong></p>
  
  <pre><code>$('#sign_up_user').bind('ajax:success', function( data, status, xhr) {
    alert("success");
  });
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>class RegistrationsController &lt; Devise::RegistrationsController
  
    def create
      build_resource
  
      if resource.save
        if resource.active_for_authentication?
          set_flash_message :notice, :signed_up if is_navigational_format?
          sign_up(resource_name, resource)
          return render :json =&gt; {:success =&gt; true}
        else
         set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
         expire_session_data_after_sign_in!
         return render :json =&gt; {:success =&gt; true}
        end
      else
        clean_up_passwords resource
        return render :json =&gt; {:success =&gt; false}
      end
    end
  
  # Signs in a user on sign up. You can overwrite this method in your own RegistrationsController
    def sign_up(resource_name, resource)
      sign_in(resource_name, resource)
    end
  
  end
  </code></pre>
  
  <p><strong>Log</strong></p>
  
  <pre><code>Started POST "/users" for 127.0.0.1 at 2013-08-13 22:12:51 -0500
  Processing by Devise::RegistrationsController#create as JS
  Parameters: {"utf8"=&gt;"✓",  "authenticity_token"=&gt;"mrcZMq5WT1QPNpGDGsVFWIPx+WqfI0PZmHfGqs7jnrM=", "user"=&gt; {"username"=&gt;"ksks", "email"=&gt;"jsjs@t.comq", "password"=&gt;"[FILTERED]", "password_confirmation"=&gt;"[FILTERED]", "address"=&gt;"", "business"=&gt;"0"}, "commit"=&gt;"Sign up"}
  
  (0.2ms)  SELECT 1 FROM "users" WHERE LOWER("users"."email") = LOWER('jsjs@t.comq')  LIMIT 1
  SQL (2.6ms)  INSERT INTO "users" ("address", "business", "business_name",  "business_type", "city", "created_at", "current_sign_in_at", "current_sign_in_ip", "email", "encrypted_password", "last_sign_in_at", "last_sign_in_ip", "phone", "remember_created_at", "remember_token", "reset_password_token", "sign_in_count", "state", "updated_at",  "username", "zipcode") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["address", nil], ["business", false], ["business_name", nil], ["business_type", nil], ["city", nil], ["created_at", Wed, 14 Aug 2013 03:12:52 UTC +00:00], ["current_sign_in_at", nil], ["current_sign_in_ip", nil], ["email", "jsjs@t.comq"], ["encrypted_password", "$2a$10$uynKQ8s3sjBe5W3LfqFxSO9Z2jg9FB.m8LbVOiiBNqDtT9qF1j7Sy"], ["last_sign_in_at", nil], ["last_sign_in_ip", nil], ["phone", nil], ["remember_created_at", nil], ["remember_token", nil], ["reset_password_token", nil], ["sign_in_count", 0], ["state", nil], ["updated_at",  Wed, 14 Aug 2013 03:12:52 UTC +00:00], ["username", "ksks"], ["zipcode", nil]]
    (0.4ms)  UPDATE "users" SET "last_sign_in_at" = '2013-08-14 03:12:52.570849', "current_sign_in_at" = '2013-08-14 03:12:52.570849', "last_sign_in_ip" = '127.0.0.1', "current_sign_in_ip" = '127.0.0.1', "sign_in_count" = 1, "updated_at" = '2013-08-14 03:12:52.572092' WHERE "users"."id" = 35
  </code></pre>