From 971fa4cd364d86bc5e999520517e85804c5a6d58 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 14 Mar 2005 15:56:46 +0000 Subject: Made async callbacks work with :update git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@904 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/javascript_helper.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 6ce1d05e2c..619ce94341 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -96,12 +96,16 @@ module ActionView 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); } -- cgit v1.2.3