Friday, August 27, 2010

[Rails] How can I do an onChange event with Rails3 and jQuery?

I'm using jQuery with Rails3.

I'd like to trigger some AJAX on the change of a SELECT element.

I've tried the old Prototype way: {:onchange
=>remote_function(:update => "mytable", :url => "/xxx")}

I get a JS error: "Ajax is not defined"

I assume it's trying to use Prototype and that's where the error comes
from.

I'd love to use Unobtrusive Javascript, but I don't want to submit the
WHOLE form. I just want the ONCHANGE of a SELECT element to trigger
AJAX and update a specific piece of the page.

I can't find any documentation anywhere that describes how to do this.

Anyone know any resources or know how to do this?

Thanks,
Andy

--
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate