Permalink
Browse files

Made async callbacks work with :update

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@904 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 0c0a107 commit 971fa4cd364d86bc5e999520517e85804c5a6d58 @dhh dhh committed Mar 14, 2005
Showing with 8 additions and 4 deletions.
  1. +8 −4 actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -96,12 +96,16 @@ def define_javascript_functions
var url = arguments[1];
var parameters = arguments[2];
var async = arguments[3];
+ var callbacks = arguments[4];
if (async) {
- xml_request(url, parameters, true,
- { complete: function(request) {
- container.innerHTML = request.responseText }
- })
+ if(!callbacks) callbacks = {}
+ complete = callbacks['complete']
+ callbacks['complete'] = function(request) {
+ container.innerHTML = request.responseText
+ if(complete) complete(request)
+ }
+ xml_request(url, parameters, true, callbacks)
} else {
container.innerHTML = xml_request(url, parameters);
}

0 comments on commit 971fa4c

Please sign in to comment.