jrails加载remote_form_tagrails
我最近在一个应用程序中使用 jRails 切换到 jQuery。我之前的 RJS 99% 似乎都能完美运行,唯一的例外是 :loading =>;使用remote_form_tag时的回调。
<% 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;">
我还尝试了回调 :before 和 :after 而不是 :loading 并且什么也没有...有什么想法吗?或者这个功能不适用于 jRails?
谢谢
I recently switched to jQuery using jRails for an app. 99% of all my previous RJS seems to work perfectly, the only except is the :loading => callback when using the remote_form_tag.
<% form_remote_tag :url => '/hostels/update_currency', :loading => visual_effect(:appear, :load_currency), :html => { :id => 'currency' } do %>
I have a hidden DIV #load_currency which worked perfect before using the provided prototype helpers
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001648
But using the new jRails alternative, this feature doesn't seem to work?
I tried using RJS and jQuery directly:
:loading => visual_effect(:appear, :load_currency)
:loading => "$('#load_currency').show();"
which product this in the 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;">
I also tried the callbacks :before and :after instead of :loading and also got nothin... any ideas? Or does this feature just not work with jRails?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现避免内联 javascript 并编写普通的旧 jquery 更干净。你可以尝试这样的事情:
I find it cleaner to avoid the inline javascript and write plain old jquery. You might try something like this: