私のレールアプリで、ユーザーがボタンをクリックすると、ブラウザはjs投稿要求を送信し、コントローラは何かを計算し、ブラウザにjs SweetAlert2(swal)を返します。rails SweetAlert 2がie11で動作しない
クローム、ファイヤーフォックス、サファリでうまく機能します。しかし、ie11では、ボタンをクリックしても何も起こりません!どんな考え?
ここには、js投稿要求を送信するビュー内のsubmit_tagボタンがあります。ここで
<%= form_tag('check_exemption', remote: true) do %>
# Here are some radio buttons that are used to pass parameters to the controller.
<p><%= submit_tag('Check Exemption', class: 'btn btn-danger btn-block btn-xl') %></p>
<% end %>
は、ルートである:ここでは
post ':action', to: 'protected_assets#check_exemption'
はprotected_assets_controllerでのアクションである:ここで
def check_exemption
# Here the controller calculates some stuff to be returned in the swal below.
respond_to do |format|
format.html { redirect_to root_url }
format.js { render js: "swal('#{@financial_product.product_exemption_text}', '#{@financial_product.twelve_months_exempt_text} #{@financial_product.withdrawals_exemption_text}', '#{@financial_product.swal_type}')" }
end
end
はIE11は、我々はのSwaIが正しく返されることがわかりパネルを検査です。しかし、スワールは画面に表示されません!ページもそれが必要のような要求ではなく、JSのHTML要求された場合はroot_urlにリダイレクトされていないことに注意してください:
私はレールに新しい趣味、ウェブ開発、ジャバスクリプト、HTMLのだけど、あなたの子供や賢い犬に話していたかのようにあなたの答えを書いてください。