Reputation: 1775
I have following code in my view:
<span class="pull-right">
<%= link_to 'Siblings', siblings_path(cnic: '21303-51235-5'), id: 'view_siblings' %>
</span>
<%= f.text_field :cnic, class: "form-control" %>
As for now i have given fixed value to cnic parameter. What i want is:
If user type his cnic then this user input should be sent as parameter to siblings_path.
How can i do that?
Upvotes: 0
Views: 193
Reputation: 2478
$(".form-control").change(function(e) {
$("#view_siblings").prop("href", siblings_path + "?cnic=" + e.target.value);
// replace siblings_path with actual url
})
Upvotes: 1