Skip to content

Instantly share code, notes, and snippets.

@bear454
Created August 27, 2009 19:17
Show Gist options
  • Save bear454/176488 to your computer and use it in GitHub Desktop.
Save bear454/176488 to your computer and use it in GitHub Desktop.
Bare example of link_to_remote: clicking the "Update" link in the view will change the text in the update_me span to 'Updated text.'
<span id="update_me">Some text that needs to be updated.</span>
<%=link_to_remote "Update", :url => "/update/something", :update => 'update_me' %>
# GET /update/something
# POST /update/something
def something
respond_to do |format|
format.js { render :text => 'Updated text.' }
end
end
#clicking the "Update" link in the view will change the text in the update_me span to 'Updated text.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment