0

My code:

application.js

//= require jquery
//= require jquery_ujs

index.html.erb

<%= link_to("test", {:controller => 'user', :action => 'create'} , :remote => true ) %>

create.js.erb

alert('click from crate.js.erb');

If I don't use //= require jquery_ujs and :remote=>true, i get an error.

How i use jquery without jquery_ujs and :remote true?

3
  • You're saying you just want the user to click on your link_to and see the user#create page? Commented Sep 2, 2015 at 5:37
  • no, he wants to use the remote feature without the ujs. funny Commented Sep 2, 2015 at 5:58
  • @HuanSon; @MarsAtomic; : i want using '<%= link_to("test",:class="btn-me" ) %> 'and js external in app/assets/javascripts/something.js with jquery onclick without ':remote => true' .. what it can? Thanks for your help Commented Sep 2, 2015 at 10:24

1 Answer 1

2

Rails 3: Using link_to :remote => true with jQuery UJS

The Rails Unobtrusive Javascript (UJS) library provides two main pieces of functionality:

You can add add :remote => true to link_to and the link will be submitted via AJAX.

You can add :remote => true to form_for and the form will be submitted via 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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your help, i want using '<%= link_to("test",:class="btn-me" ) %> 'and js external in app/assets/javascripts/something.js with jquery onclick without ':remote => true' .. what it can?
So use the Assets Pipeline and Include the ujs in external

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.