From 9727d2e6f90757774866a39dd21f9f3bbc0bfb32 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Thu, 24 Feb 2011 17:08:21 +1300 Subject: [PATCH] BUGFIX: rewriting overridden ajax success handler to work with new ajax function in jQuery 1.5 --- javascript/jquery-ondemand/jquery.ondemand.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/javascript/jquery-ondemand/jquery.ondemand.js b/javascript/jquery-ondemand/jquery.ondemand.js index 0110e2f69..90f9b18c6 100644 --- a/javascript/jquery-ondemand/jquery.ondemand.js +++ b/javascript/jquery-ondemand/jquery.ondemand.js @@ -149,13 +149,15 @@ var _dataType = s.dataType; // This replaces the usual ajax success & complete handlers. They are called after any on demand JS is loaded. - var _ondemandComplete = function(xml, status) { - var status = $.httpSuccess(xml) ? 'success' : 'error'; + var _ondemandComplete = function(data, status) { + //var status = $.httpSuccess(xml) ? 'success' : 'error'; //rewrote success function as httpSuccess doesn't exist anymore in jQuery 1.5 + if (typeof status == 'undefined' || status != 'success') status = 'error'; + if(status == 'success') { - var data = jQuery.httpData(xml, _dataType); + //var data = jQuery.httpData(xml, _dataType); //unnecessary as data type conversion is automatically done in jQuery 1.5 using the ajaxConvert method if(_success) _success(data, status); } - if(_complete) _complete(xml, status); + if(_complete) _complete(data, status); } // We remove the success handler and take care of calling it outselves within _ondemandComplete