Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7525369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:31:32+00:00 2026-05-30T03:31:32+00:00

As in the title, I`ve made sure all needed JS files are included in

  • 0

As in the title, I`ve made sure all needed JS files are included in the meta tags, included the jquery-rails/coffee-rails gem, linked to a external one just in case.

This is a modified script from Ryan Bates tutorial on Stripe, from what I understand it`s suppose to fire up by detecting the submit action from the form.

Since I’m not that familiar with JS or CoffeeScript, I can’t really pin point what’s the problem here.

Would appreciate any help I can get.

The donations.js file:

jQuery ->
      Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content'))
      donation.setupForm()

donation =
  setupForm: ->
    $('#new_donation').submit ->
      $('input[type=submit]').attr('disabled', true)
      if $('#card_number').length
        donation.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, donation.handleStripeResponse)

  handleStripeResponse: (status, response) ->
    if status == 200
      alert(response.id)
    else
      alert(response.error.message)

The donations/new.html.erb form

<%= form_for(@donation) do |f| %>
                <div class="field">
                    <%= f.label :from %>
                    <%= f.text_field :from %>
                </div>
                <div class="field">
                  <%= label_tag :card_number, "Credit Card Number" %>
                  <%= text_field_tag :card_number, nil, :name => nil %>
                </div>
                <div class="field">
                  <%= label_tag :card_code, "Security Code (CVV)" %>
                  <%= text_field_tag :card_code, nil, :name => nil %>
                </div>

                <div class="field">
                  <%= label_tag :card_month, "Card Expiration" %>
                  <%= select_month nil, {:add_month_numbers => true}, {:name => nil, :id => "card_month"} %>
                  <%= select_year nil, {:start_year => Date.today.year, :end_year => Date.today.year+15}, {:name => nil, :id => "card_year"} %>
                </div>
                <div class="field">
                    <%= f.label :Notes %>
                    <%= f.text_field :note %>
                </div>
                <br>
                <center>
                    <span class="BigBold">Amount: $2.50</span>
                    <%= f.hidden_field :amount, {:value => "2,5" } %><br>
                </center>
                <br>
                <center>
                    <%= f.submit "Donate Now", :class => 'donate-button' %>
                </center>
            <% end %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:31:33+00:00Added an answer on May 30, 2026 at 3:31 am

    Your javascript seems to be, well, Coffeescript – make sure it’s put in its own donations.js.coffee file, and that you’re including the coffee-rails gem while you’re at it.

    Standard debugging techniques would be useful here – try adding an alert("It lives!") or something after the initial jQuery -> line to see if the document.ready handler is ever being called.

    If not, check to make sure that the donations.js.coffee file is being loaded in the first place, and if not, make sure you’re either loading it in your page’s header, or you have something like this in application.js:

    //= require jquery
    //= require donations
    

    Or, if you just want to include everything in app/assets/javascripts:

    //= require jquery
    //= require_tree .
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Old title: Included PHP doesn't work with JQuery and IE in a function as
(Not sure if this title is the best description...) Hi all. I need a
Hello people I have made a custom title bar for my app. I would
Just as the title says. As i went through different explanations for choices made
As you can guess from the title, the outlining with regions finally made me
Ok, the title is a bit confusing, but here's my predicament. I've made a
Title pretty much describes it, I just need to get all the order numbers
Title sais it all really. private bool addToBinary(byte[] msg, string filepath) { bool succ
(I'm not sure how to make the title more clear - feel free to
Sorry for the not very descriptive question title. I'm not very sure how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.