link_to_remote with anchor

Giant Cranes wrote:


I would like to jump to an anchor on a page once an AJAX action has been
performed (a new page of data has been returned and I would like to
present the top of this list to the user).

Is there a way to specify an anchor in link_to_remote? If not, is there
something that I can do in the RJS template?


I've found that typically you can add :html=>{} block to edit most HTML
related elements. in this case you can add :html =>{:href =>
"#anchor_name"} to your link_to_remote.

example :
link_to_remote "link text", :update => "element",
                :html => {:href => "#bottom_anchor"},
                :url => { :controller => "your_controller",
                          :action => "your_action"},
                :loading => "$('spinner').show();"