Questions tagged [link-to-remote]

60 questions
12
votes
3 answers

Rails :confirm modifier callback?

I want to call a javascript function that will be conditional upon a user's response to the confirm box. For example, I have the following anchor: <%= link_to 'Sign Out', destroy_session_path, confirm: 'Are you sure that you would like to sign…
6
votes
1 answer

Using link_to remote: true to pass parameters to rails

So I have a page with several messages, each with a link that changes (refines) the RATING of that message. When a user clicks on this link, I want an AJAX call that updates the corresponding column value in the database for that message. When…
Michael Choi
  • 134
  • 1
  • 10
5
votes
2 answers

Rails3 - How to send Javascript Variable to a controller's action with the link_to helper?

If i have the following javascript code var myVar = 0; function setNewValforVar(newValue){ myVar = newValue; } and i'm calling setNewValforVar function n times so when I click on a link it'd send myVar value to the controller action in a…
Mr_Nizzle
  • 6,644
  • 12
  • 55
  • 85
5
votes
3 answers

Rails 3 - How to send data on link_to :remote=>true?

I am trying to figure out the new link_to in Rails 3 but i still don't get it In Rails 2 I do: <%= link_to_remote "My Link",:url=>{:action=>:myaction},:with=>"'data='+$('#someField').attr('value')" %> but with the new syntax in Rails 3 how should…
Mr_Nizzle
  • 6,644
  • 12
  • 55
  • 85
4
votes
1 answer

render :update on Rails 3.1.0 gives me Missing Template update

I'm working with rails 3.1.0 and this is my first application on 3.1.0 I have a remote link: link_to "my link",{:controller=>"my_controller",:action=>"my_action"},:remote=>true and in my_controller I have def my_action @data = Data.all …
Mr_Nizzle
  • 6,644
  • 12
  • 55
  • 85
3
votes
2 answers

Passing object from view to controller

Is there a way to pass a object, specifically a form_builder object used in a view, to an action in the controller? I am using a link_to_remote and want to update a variable in the controller and then add a new nested form element to my form via a…
sutee
  • 12,568
  • 13
  • 49
  • 61
3
votes
2 answers

Add extra data in ajax:beforeSend (link_to)?

I have a link_to with remote: set to true. What I want to do is add an extra attribute with the request so I tried it with this: