How to take text_field value in a variable before form submit

Hello friends,

I am new in ruby on rails, I want to take text_field value in a variable
then this variable value, I want to pass controller method throw
form_for method.

_employee.html.erb file

<%= text_field :offer_id, { class: 'form-control', id: 'offer_id' } %>

<%= form_for :employee_details, :url =>{:controller => “hr”, :action =>
“update”, :offer_id =>2 } do |f| %>

------------ here my other code --------------------
<% end %>

I want to sent variable value in place “:offer_id => 2(variable value)”.

JavaScript code on the same page: