1. The following javascript is being defined in myapp/public/
javascripts/application.js

jQuery(function($) {
// when the #search field changes
$("#category").change(function() {
// make a POST call and replace the content
$.post(<%= category_sub_categories_path %>, function(data) {
$("#results").html(data);
});
});
})

2. this javascript is being applied to the myapp/app/views/parts/
_form.html.erb partial template

My question is, if there is a rails variable, @categories in the
partial template, I need to pass the @categories.id value to the
javascript from there.
Would this work?


If somebody understands this and could comment, kindly share your
input.
Thank you

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 31, '11 at 3:55a
activeJan 1, '12 at 4:04a
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

K.M.: 2 posts Leonardo Mateo: 1 post

People

Translate

site design / logo © 2021 Grokbase