Created
August 27, 2009 19:17
-
-
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.'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span id="update_me">Some text that needs to be updated.</span> | |
<%=link_to_remote "Update", :url => "/update/something", :update => 'update_me' %> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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