I would like to use the jQuery ajax method $.get to access a restful route in rails. Something like this (keep in mind this is done in a haml template where I can use string interpolation):
$(function(){
$(':radio').change(function(){
$.get("#{edit_steps_path(N)}");
}
});
In the snippet above #{steps_path(N)}
interpolates to the URL "\steps\N"
and N
is the value of the radio button that has been changed.
Obviously this doesn't work as the string interpolation happens on the server before the radio button can fire the change event. Clearly my approach to this problem is wrong altogether.
I've come up with some other ways of solving this problem, but none of them allow me to use the Rails route helpers or string interpolation, and I'm kind of bent on doing.
I'm guessing there is a proper way to accomplish what I'm seeking, just not sure what it is.