mardi 14 avril 2015

get textbox value from javascript for where clause rails view

I have a content_tag and the value is coming from Javascript.



<%= content_tag :td, nil, data: {code: A_Code} %> # Assume this is VariableONE


I have a condition on next line like the following:



<% next_value = Product::Detail.find_user.where(B_Code: VariableONE) %>


I want to pass this value to the following content tag



<%= content_tag :span, id: 'new_value' %>


So, I want to set the next_value variable to the above content_tag(#new_value)


Please someone pointing me to achieve this in a nice way or is it possible that I can assign variable of the whole content_tag like the following:



VariableOne = <%= content_tag :td, nil, data: {code: A_Code} %>

Aucun commentaire:

Enregistrer un commentaire