Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved documentation for :success/:failure callbacks #1699 [Thomas …

…Fuchs]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1812 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 216b0e0fbab310d374d2a43fe774839ac8ce6cdb 1 parent 5b9b904
David Heinemeier Hansson dhh authored
Showing with 11 additions and 8 deletions.
  1. +11 −8 actionpack/lib/action_view/helpers/javascript_helper.rb
19 actionpack/lib/action_view/helpers/javascript_helper.rb
View
@@ -72,7 +72,7 @@ def link_to_function(name, function, html_options = {})
# :url => { :action => "undo", :n => word_counter },
# :complete => "undoRequestCompleted(request)"
#
- # The callbacks that may be specified are:
+ # The callbacks that may be specified are (in order):
#
# <tt>:loading</tt>:: Called when the remote document is being
# loaded with data by the browser.
@@ -81,13 +81,15 @@ def link_to_function(name, function, html_options = {})
# <tt>:interactive</tt>:: Called when the user can interact with the
# remote document, even though it has not
# finished loading.
- # <tt>:complete</tt>:: Called when the XMLHttpRequest is complete,
- # and the HTTP status code is 200 OK.
- # <tt>:failure</tt>:: Called when the XMLHttpRequest is complete,
- # and the HTTP status code is anything other than
- # 200 OK.
- #
- # You can further refine <tt>:failure</tt> by adding additional
+ # <tt>:success</tt>:: Called when the XMLHttpRequest is completed,
+ # and the HTTP status code is in the 2XX range.
+ # <tt>:failure</tt>:: Called when the XMLHttpRequest is completed,
+ # and the HTTP status code is not in the 2XX
+ # range.
+ # <tt>:complete</tt>:: Called when the XMLHttpRequest is complete
+ # (fires after success/failure if they are present).,
+ #
+ # You can further refine <tt>:success</tt> and <tt>:failure</tt> by adding additional
# callbacks for specific status codes:
#
# Example:
@@ -96,6 +98,7 @@ def link_to_function(name, function, html_options = {})
# 404 => "alert('Not found...? Wrong URL...?')",
# :failure => "alert('HTTP Error ' + request.status + '!')"
#
+ # A status code callback overrides the success/failure handlers if present.
#
# If you for some reason or another need synchronous processing (that'll
# block the browser while the request is happening), you can specify
Please sign in to comment.
Something went wrong with that request. Please try again.