From 216b0e0fbab310d374d2a43fe774839ac8ce6cdb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 11 Jul 2005 06:44:10 +0000 Subject: 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 --- .../lib/action_view/helpers/javascript_helper.rb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 7034b95000..0c22996e02 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -72,7 +72,7 @@ module ActionView # :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): # # :loading:: Called when the remote document is being # loaded with data by the browser. @@ -81,13 +81,15 @@ module ActionView # :interactive:: Called when the user can interact with the # remote document, even though it has not # finished loading. - # :complete:: Called when the XMLHttpRequest is complete, - # and the HTTP status code is 200 OK. - # :failure:: Called when the XMLHttpRequest is complete, - # and the HTTP status code is anything other than - # 200 OK. - # - # You can further refine :failure by adding additional + # :success:: Called when the XMLHttpRequest is completed, + # and the HTTP status code is in the 2XX range. + # :failure:: Called when the XMLHttpRequest is completed, + # and the HTTP status code is not in the 2XX + # range. + # :complete:: Called when the XMLHttpRequest is complete + # (fires after success/failure if they are present)., + # + # You can further refine :success and :failure by adding additional # callbacks for specific status codes: # # Example: @@ -96,6 +98,7 @@ module ActionView # 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 -- cgit v1.2.3