[英]How to use jquery and javascript without jquery_ujs in rails
My code: 我的代码:
application.js application.js
//= require jquery
//= require jquery_ujs
index.html.erb index.html.erb
<%= link_to("test", {:controller => 'user', :action => 'create'} , :remote => true ) %>
create.js.erb create.js.erb
alert('click from crate.js.erb');
If I don't use //= require jquery_ujs
and :remote=>true
, i get an error. 如果我不使用
//= require jquery_ujs
和:remote=>true
,则会出现错误。
How i use jquery without jquery_ujs
and :remote true
? 我如何在没有
jquery_ujs
和:remote true
情况下使用jquery?
Rails 3: Using link_to :remote => true with jQuery UJS Rails 3:使用link_to:remote => true与jQuery UJS
The Rails Unobtrusive Javascript (UJS) library provides two main pieces of functionality: Rails入门Java(UJS)库提供了两个主要功能:
You can add add :remote => true to link_to and the link will be submitted via AJAX.
您可以在link_to中添加add :remote => true ,链接将通过AJAX提交。
You can add :remote => true to form_for and the form will be submitted via AJAX.
您可以在form_for中添加:remote => true ,该表单将通过AJAX提交。
there is no way to use this feature without the jQUJS of course you could do this by yourself - but better question yourself why you dont want to stick with ujs. 如果没有jQUJS,就无法使用此功能,当然您可以自己执行此操作-但最好问自己一个问题,为什么不想坚持使用ujs。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.