最近、アプリに jRails を使用して jQuery に切り替えました。以前のすべての RJS の 99% は完全に機能しているようですが、唯一の例外は、remote_form_tag を使用する場合の :loading => コールバックです。
<% form_remote_tag :url => '/hostels/update_currency', :loading => visual_effect(:appear, :load_currency), :html => { :id => 'currency' } do %>
提供されたプロトタイプ ヘルパーを使用する前に完璧に機能する非表示の DIV #load_currency があります。
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001648
しかし、新しい jRails の代替手段を使用すると、この機能が機能しないように見えますか?
RJS と jQuery を直接使用してみました:
:loading => visual_effect(:appear, :load_currency)
:loading => "$('#load_currency').show();"
html でこれをどの製品にするか:
onsubmit="jQuery.ajax({beforeSend:function(request){jQuery("#load_currency").fadeIn();}, data:jQuery.param(jQuery(this).serializeArray()) + '&authenticity_token=' + encodeURIComponent('O7Y7wzFoPPxGSTxIb2bQ3zshrUP+h1OGAUdtyzdQz0A='), dataType:'script', type:'post', url:'/hostels/update_currency'}); return false;">
:loading の代わりにコールバック :before と :after も試しましたが、何も得られませんでした...何かアイデアはありますか? それとも、この機能は jRails では動作しないのでしょうか?
ありがとう