You will need to also send the authenticity token along with Ajax requests if its a request besides a GET request. Module: ActionController::RequestForgeryProtection::ClassMethods<http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html>
Read up on RJS, Prototype JS and Rails' Javascript Helpers. Its a lot of fun! Good luck.. 2009/8/3 Ram <yourstruly.vi...@gmail.com> > > This should work > > <%= select_tag :resort_id, "<option>-Select a resort</ > option>"+options_from_collection_for_select > (@resorts, :id, :name), :onchange => "new Ajax.Request('/resorts/'+ > (value), {asynchronous:true, evalScripts:true, method:'get', > parameters:'id=' + encodeURIComponent(value)});" %> > > Check the dev log for debugging if you run into any problems. You can > also use FF's Firebug to debug JS. > > On Aug 3, 1:07 pm, bingo bob <rails-mailing-l...@andreas-s.net> wrote: > > Hi Ram, > > > > That looks ideal. Your thinking is absolutely on the right lines in that > > I'm simply looking for the select to allow the user to jump to the show > > action of the resorts controller passing in the resort ID. Using Ajax to > > do this is fine by me. > > > > Just a few questions > > > > 1) I can't get the code to work as it is, I'm getting a syntax error - > > figuring that there's a bracket missing or something - I did try to > > correct but couldn't seem to! > > > > 2) For the Ajax request to work do I need to do anything else special in > > the app to allow it to work? > > > > Cheers, > > > > bb > > -- > > Posted viahttp://www.ruby-forum.com/. > > > -- In Sport We Trust !!! --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---