Javascript 条带支付网关问题ruby on rails(TypeError:window.multimedia(…)为空) 在firebug控制台=>(TypeError:window.matchMedia(…)为空)上出现此错误
当我点击paywithcard按钮时,我会在firebug控制台上看到(TypeError:window.multimedia(…)为空) button.html.erbJavascript 条带支付网关问题ruby on rails(TypeError:window.multimedia(…)为空) 在firebug控制台=>(TypeError:window.matchMedia(…)为空)上出现此错误,javascript,jquery,ruby-on-rails,ruby-on-rails-4,stripe-payments,Javascript,Jquery,Ruby On Rails,Ruby On Rails 4,Stripe Payments,当我点击paywithcard按钮时,我会在firebug控制台上看到(TypeError:window.multimedia(…)为空) button.html.erb <%= form_tag front_charges_path do %> <article> <% if flash[:error].present? %> <div id="error_explanation"> <p>&l
<%= form_tag front_charges_path do %>
<article>
<% if flash[:error].present? %>
<div id="error_explanation">
<p><%= flash[:error] %></p>
</div>
<% end %>
<label class="amount">
<span>Amount: <%=@cart_totals%></span>
</label>
</article>
<script src="https://js.stripe.com/v3/"></script>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<%= Stripe.api_key = "pk_test_******************" %>"
data-description="A month's subscription"
data-amount="<%=@cart_totals%>"
data-locale="auto"></script>
<% end %>
<script type="text/javascript">
var widthQuery = window.matchMedia("(min-width: 600px)");
</script>
Rails.configuration.stripe = {
:publishable_key => ENV['pk_test_****************'],
:secret_key => ENV['sk_test_************']
}
Stripe.api_key = "sk_test_****************"
class Front::ChargesController < ApplicationController
layout 'product'
def new
end
def create
# Amount in cents
@amount = 500
customer = Stripe::Customer.create(
:email => params[:ronakabhattrz],
:source => params[:stripeToken]
)
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => @amount,
:description => 'Rails Stripe customer',
:currency => 'INR'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
end
充电\u控制器.rb
<%= form_tag front_charges_path do %>
<article>
<% if flash[:error].present? %>
<div id="error_explanation">
<p><%= flash[:error] %></p>
</div>
<% end %>
<label class="amount">
<span>Amount: <%=@cart_totals%></span>
</label>
</article>
<script src="https://js.stripe.com/v3/"></script>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<%= Stripe.api_key = "pk_test_******************" %>"
data-description="A month's subscription"
data-amount="<%=@cart_totals%>"
data-locale="auto"></script>
<% end %>
<script type="text/javascript">
var widthQuery = window.matchMedia("(min-width: 600px)");
</script>
Rails.configuration.stripe = {
:publishable_key => ENV['pk_test_****************'],
:secret_key => ENV['sk_test_************']
}
Stripe.api_key = "sk_test_****************"
class Front::ChargesController < ApplicationController
layout 'product'
def new
end
def create
# Amount in cents
@amount = 500
customer = Stripe::Customer.create(
:email => params[:ronakabhattrz],
:source => params[:stripeToken]
)
charge = Stripe::Charge.create(
:customer => customer.id,
:amount => @amount,
:description => 'Rails Stripe customer',
:currency => 'INR'
)
rescue Stripe::CardError => e
flash[:error] = e.message
redirect_to new_charge_path
end
end
class Front::ChargesControllerparams[:ronakabhattrz],
:source=>params[:stripeToken]
)
charge=Stripe::charge.create(
:customer=>customer.id,
:amount=>@amount,
:description=>“Rails条带客户”,
:货币=>'INR'
)
救援条带::CardError=>e
闪光[:错误]=e.message
重定向到新的充电路径
结束
结束
这似乎是FF中的一个顽固错误
检查变通方法似乎您在使用
var-widthQuery=window.matchMedia(“最小宽度:600px”)时遇到了问题代码>这行代码。删除它以进行检查。仍然有相同的错误请在创建widthQuery变量var window.matchMedia={}