Skip to content

Instantly share code, notes, and snippets.

@pazaricha
Created June 14, 2012 15:34
Show Gist options
  • Save pazaricha/2931009 to your computer and use it in GitHub Desktop.
Save pazaricha/2931009 to your computer and use it in GitHub Desktop.
beforeSend - doesn't work at all
=simple_form_for(@transaction, :remote => true ) do |f|
=f.error_notification
=f.input :description
=f.input :amount
=f.collection_radio_buttons :kind, [['expense', 'Expense'] ,['income', 'Income']], :first, :last
=f.button :submit, "Create New Transaction", :class => "btn btn-primary btn-large", :name => "create_transaction"
$('form#new_transaction')
.bind("ajax:beforeSend", function() {
alert("ajax:beforeSend has been triggered"); // Doesn't work...why?
})
.bind("ajax:success", function(){
alert("ajax:success has been triggered"); // Workes
})
.bind("ajax:complete", function(){
alert("ajax:complete has been triggered"); // Workes
});
$("#transaction-modal .modal-body").html("<%= escape_javascript(render :partial => "transactions/new") %>", function() {
$('#transaction-modal').modal('show');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment