Add a parameter to rails3-jquery-autocomplete (now rails-jquery-autocomplete) in addition to "term"

When autocomplete sends a query string, it contains the term parameter. See here:

  Started GET "/nodes/autocomplete_user_first_name?term=Mi" for 127.0.0.1 Processing by NodesController#autocomplete_user_first_name as JSON Parameters: {"term"=>"Mi"} 

I need to add a parameter to the value available in my view in order to get something like this, using node as the parameter and 27 as the value:

 Started GET "/nodes/autocomplete_user_first_name?term=Mi&node=27" Processing by NodesController#autocomplete_user_first_name as JSON Parameters: {"term"=>"Mi", "node" => 27} 

If I need to add a javascript file through jQuery, please tell me where it should go. I am new to js / jQuery, but I understand that. Thank!

EDIT

The reason I need the node parameter is because I need to limit the scope based on its value.

 def get_autocomplete_items(parameters) items = active_record_get_autocomplete_items(parameters) items = items.where(:id => current_user.family_tree.memberships.pluck(:user_id)) .where.not(:full_name => node.user_tags.pluck(:name)) end 
0
javascript jquery jquery-ui ruby-on-rails autocomplete
Nov 04 '15 at 20:37
source share

No one has answered this question yet.

See similar questions:

53
How to configure jquery-ui autocomplete in Rails
one
How to send other parameters with rails3-jquery-autocomplete

or similar:

2302
Add table row in jQuery
1262
What is the best way to add options to select from a JS object using jQuery?
1011
How to remove all parameters of a selection window and then add one parameter and select it using jQuery?
483
jQuery autocomplete tagging plug-in like StackOverflow input tags?
3
Zendx jQuery autocomplete
3
Rails 3.2.1 jQuery Autocomplete
3
Jquery auto-complete for rails
one
Dynamically add new options for existing custom autocomplete
0
How to change the autocomplete period before sending AJAX
0
rails formatting json.jbuilder for jquery-ui widget auto-complete



All Articles