Menu
  • HOME
  • TAGS

Rails ajax form: how to fix up fields before the form gets sent

ruby-on-rails,ajax,braintree,braintree-rails

Remove remote: true for your form and swap to using native javascript to submit your form. braintree.setup( braintree_token, 'dropin', { container: 'dropin', paymentMethodNonceReceived: function (event, nonce) { $('.braintree-checkout').append("<input type='hidden' name='payment_method_nonce' value='"+ nonce +"'></input>"); $.ajax({ url: braintree_charge_path, type: 'post', data: $('.braintree-checkout').serialize(), context: $('.braintree-checkout'), beforeSend: function(evt, xhr, settings){ // Stuff to do...