opensource-developer
opensource-developer

Reputation: 3058

link_to append parameter using javascript

I know that in rails 2.3 there is :with option available with link_to form helper. The use of it is basically the append parameters to URL. But in rails 3.1 its not working, how can i append more parameters to path using link_to in rails 3.1. Here is how it worked in rails 2.3

I need to append to my path something i get from javascript.

<%= link_to "Edit", {:url => error_prone_teacher_students_path(@store), :remote => true, :with => "'id='+$('#id').val()", :method => :get}, :id => "load", :style=>"display:none;" %>

Upvotes: 0

Views: 1197

Answers (3)

santosh dadi
santosh dadi

Reputation: 334

Rails 3 no more support this behaviour you have to create the form to submit value.

Upvotes: 2

Abibullah Rahamathulah
Abibullah Rahamathulah

Reputation: 2891

Try this.

link_to "EDIT", error_prone_teacher_students_path(@store, q1: 1, q2: 2)

Upvotes: 0

Rajdeep Singh
Rajdeep Singh

Reputation: 17834

You can do like this

<%= link_to "Edit", error_prone_teacher_students_path(@store) + "?id=parameter", :remote => true, :method => :get, :id => "load", :style=> "display:none;" %>

Hope this helps!

Upvotes: 0

Related Questions