Easiest thing to do is to make a simple remote_form_for/ form_remote_tag and look at the jQuery it produces in its onsubmit function. However, I'm a little confused, why not just put your select box inside a form tag that posts to your URL and let rails helpers + jrails do the parameter scrapping and submission for you?
On Mar 4, 1:31 am, lunaclaire <[email protected]> wrote: > Thx, Amar. > > I should have been more clear... My need for answers stems from my > ignorance of how to access values known in a view to JS and the jquery > code so that they can be accessed there or posted back to the server > thru ajax. > > curr the remote_function() call has the url params which are known in > my view (the action to post to and the obj ID of interest that the > selection is for), but I cant figure out how to generate that url in > JS/jQuery > > I think I've done this kind of thing before, but I'm missing it at the > moment. > > Can someone show me? > > On Mar 3, 9:34 pm, Amar Daxini <[email protected]> wrote: > > > lunaclaire wrote: > > > II'm switching to jQuery and wondering how do I pull the onchange: > > > stuff out of the following for a select and put it into a handler? > > > > here's what I have in my view now: > > > > <%= select_tag :selected_email, > > > options_from_collection_for_select(update_request.contact.emails, > > > 'id', 'value', update_request.contact.primary_email_id), > > > :onchange => remote_function(:url => {:action > > > => :set_request_email, :id => update_request.id}, :with => "'value=' + > > > value"), > > > :id => "request_email_#{update_request.id}" %> > > > $("#your_select_id").live("change",function(event){ > > //It return whatever value is selected > > value_of_select =$("#your_select_id").val(); > > //Now call ajax request on change > > //You can refer codehttp://railstech.com/?p=58}); > > > Refer Codehttp://railstech.com/?p=58 > > -- > > Posted viahttp://www.ruby-forum.com/. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

