javascript - Coffescript not firing in Rails application -
i'm trying integrate stripe existing education based rails application. before attempting integrate stripe, had form create order object , persist db. i'm attempting include payment on form.
i've been following railscast 288 try , this.
in tutorial, author triggers actions in coffeescript file.
the coffeescript automatically generated when generated controller.
i can not in coffeescript fire. i've tried many times on last couple of days, , feel i'm missing small.
i'm looking suggestions/places look, or perhaps there compile step i'm missing that's not listed in video?
i frantically refreshing question once it's submitted, if code snippets required, please let me know , edit.
thanks!
orders.coffee
jquery -> stripe.setpublishablekey('pk_test_dceoejsyyw9ehsjoapsmcost') order.setupform() order = setupform: -> $('#new_order').submit -> $('input[type=submit]').attr('disabled', true) if $('#card_number').length order.processcard() false else true processcard: -> card = number: $('#card_number').val() cvc: $('#card_code').val() expmonth: $('#card_month').val() expyear: $('#card_year').val() stripe.createtoken(card, order.handlestriperesponse) handlestriperesponse: (status, response) -> if status == 200 alert(response.id) else alert(response.error.message)
application.js
// manifest file that'll compiled application.js, include files // listed below. // // javascript/coffee file within directory, lib/assets/javascripts, vendor/assets/javascripts, // or plugin's vendor/assets/javascripts directory can referenced here using relative path. // // it's not advisable add code directly here, if do, it'll appear @ bottom of // compiled file. // // read sprockets readme (https://github.com/rails/sprockets#sprockets-directives) details // supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree .
Comments
Post a Comment