AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
authorDan
Sun, 25 Jan 2009 20:35:06 -0500
changeset 823 4596c40aaa94
parent 822 3b951ea8e758
child 824 28d9fbcd4f0d
AJAX core library: possible breaking change, readystatechange functions are now called with the XHR instance as the first parameter, to allow requests to run in parallel. This means much better stability but may break some applets (compatibility hack is included)
includes/clientside/static/acl.js
includes/clientside/static/ajax.js
includes/clientside/static/comments.js
includes/clientside/static/editor.js
includes/clientside/static/functions.js
includes/clientside/static/rank-manager.js
includes/clientside/static/theme-manager.js
--- a/includes/clientside/static/acl.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/acl.js	Sun Jan 25 20:35:06 2009 -0500
@@ -24,7 +24,7 @@
     };
   params = toJSONString(params);
   params = ajaxEscape(params);
-  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         var response = String(ajax.responseText + '');
@@ -61,7 +61,7 @@
     mode: 'seltarget_id'
   };
   params = ajaxEscape(toJSONString(params));
-  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         var response = String(ajax.responseText + '');
@@ -113,7 +113,7 @@
   }
   params = toJSONString(params);
   params = ajaxEscape(params);
-  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         document.getElementById(aclManagerID+'_main').innerHTML = '';
@@ -401,7 +401,7 @@
 {
   params = toJSONString(params);
   params = ajaxEscape(params);
-  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         var response = String(ajax.responseText + '');
@@ -482,7 +482,7 @@
             };
           params = toJSONString(params);
           params = ajaxEscape(params);
-          ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
+          ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 )
               {
                 document.getElementById(aclManagerID+'_main').innerHTML = '';
@@ -1499,7 +1499,7 @@
   var request = toJSONString({
       mode: 'list_presets'
     });
-  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(request), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(request), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1758,7 +1758,7 @@
   
   var whitey = whiteOutElement(document.getElementById(aclManagerID));
   
-  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(packet), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=acljson', 'acl_params=' + ajaxEscape(packet), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
--- a/includes/clientside/static/ajax.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/ajax.js	Sun Jan 25 20:35:06 2009 -0500
@@ -13,7 +13,7 @@
   enableUnload();
   setAjaxLoading();
   var redir = ( disable_redirect ) ? '&redirect=no' : '';
-  ajaxGet(append_sid(scriptPath + '/ajax.php?title=' + physical_title +'&_mode=getpage&noheaders' + redir), function() {
+  ajaxGet(append_sid(scriptPath + '/ajax.php?title=' + physical_title +'&_mode=getpage&noheaders' + redir), function(ajax) {
     // Allow for 404 here, it's generated by the "page not found" error message
     // (even with noheaders specified, probably should be fixed)
     if ( ajax.readyState == 4 && ( ajax.status == 200 || ajax.status == 404 ) ) {
@@ -50,7 +50,7 @@
   document.getElementById('protbtn_1').style.textDecoration = 'none';
   document.getElementById('protbtn_2').style.textDecoration = 'none';
   document.getElementById('protbtn_'+l).style.textDecoration = 'underline';
-  ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=protect', 'reason='+ajaxEscape(r)+'&level='+l, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       if(ajax.responseText == 'good')
@@ -177,7 +177,7 @@
   whiteout.style.width = ( $dynano(whiteout).Width() - 78 ) + 'px';
   whiteout.style.left = ( $dynano(whiteout).Left() + 44 ) + 'px';
   
-  ajaxPost(stdAjaxPrefix + '&_mode=rename', 'newtitle=' + ajaxEscape(newname), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=rename', 'newtitle=' + ajaxEscape(newname), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -367,7 +367,7 @@
   
   // tenemos la confirmación y la razón - borre la página.
   setAjaxLoading();
-  ajaxPost(stdAjaxPrefix + '&_mode=deletepage', 'reason=' + ajaxEscape(trim(reason.value)), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=deletepage', 'reason=' + ajaxEscape(trim(reason.value)), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -424,7 +424,7 @@
           {
             miniPromptDestroy(this);
             setAjaxLoading();
-            ajaxGet(stdAjaxPrefix+'&_mode=delvote', function() {
+            ajaxGet(stdAjaxPrefix+'&_mode=delvote', function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 ) {
                 unsetAjaxLoading();
                 alert(ajax.responseText);
@@ -464,7 +464,7 @@
           {
             miniPromptDestroy(this);
             setAjaxLoading();
-            ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function() {
+            ajaxGet(stdAjaxPrefix+'&_mode=resetdelvotes', function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 ) {
                 unsetAjaxLoading();
                 alert(ajax.responseText);
@@ -499,7 +499,7 @@
   if ( KILL_SWITCH )
     return true;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=catedit', function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=catedit', function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -526,7 +526,7 @@
   }
   setAjaxLoading();
   query = query.substring(1, query.length);
-  ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=catsave', query, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -544,7 +544,7 @@
   if ( KILL_SWITCH )
     return true;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=histlist', function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=histlist', function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -562,7 +562,7 @@
     return true;
   if(!ttl) ttl=title;
   setAjaxLoading();
-  ajaxGet(append_sid(scriptPath+'/ajax.php?title='+ttl+'&_mode=getpage&oldid='+oldid), function() {
+  ajaxGet(append_sid(scriptPath+'/ajax.php?title='+ttl+'&_mode=getpage&oldid='+oldid), function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       edit_open = false;
@@ -576,7 +576,7 @@
   if ( KILL_SWITCH )
     return true;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=rollback&id='+id, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       
@@ -629,7 +629,7 @@
           {
             miniPromptDestroy(this);
             setAjaxLoading();
-            ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function() {
+            ajaxGet(stdAjaxPrefix+'&_mode=flushlogs', function(ajax) {
               if ( ajax.readyState == 4 && ajax.status == 200 ) {
                 unsetAjaxLoading();
                 alert(ajax.responseText);
@@ -721,7 +721,7 @@
   }
   if(!id1 || !id2) { alert('BUG: Couldn\'t get checked radiobutton state'); return; }
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function()
+  ajaxGet(stdAjaxPrefix+'&_mode=pagediff&diff1='+id1+'&diff2='+id2, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -765,12 +765,11 @@
   {
     return null;
   }
-  ajaxGet(stdAjaxPrefix + '&_mode=getstyles&id=' + id, function() {
+  ajaxGet(stdAjaxPrefix + '&_mode=getstyles&id=' + id, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         // IE doesn't like substr() on ajax.responseText
-        var response = String(ajax.responseText + ' ');
-        response = response.substr(0, response.length - 1);
+        var response = String(ajax.responseText + '');
         if ( response.substr(0,1) != '[' )
         {
           alert('Invalid or unexpected JSON response from server:\n' + response);
@@ -839,7 +838,7 @@
     return true;
   }
   
-  ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + ajaxEscape(theme_id) + '&style_id=' + ajaxEscape(style_id), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=change_theme', 'theme_id=' + ajaxEscape(theme_id) + '&style_id=' + ajaxEscape(style_id), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -885,7 +884,7 @@
   load_component('crypto');
   pass = hex_sha1(document.getElementById('mdgPassSetField').value);
   setAjaxLoading();
-  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function()
+  ajaxPost(stdAjaxPrefix+'&_mode=setpass', 'password='+pass, function(ajax)
     {
       unsetAjaxLoading();
       if ( ajax.readyState == 4 && ajax.status == 200 )
@@ -910,7 +909,7 @@
   }
   $killdiv.object.innerHTML = '<img alt="Loading..." src="' + scriptPath + '/images/loading-big.gif" /><br />Making request...';
   var url = makeUrlNS('Admin', 'Home', 'src=ajax');
-  ajaxPost(url, 'act=kill_php', function() {
+  ajaxPost(url, 'act=kill_php', function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         if ( ajax.responseText == '1' )
@@ -941,7 +940,7 @@
   if ( KILL_SWITCH )
     return false;
   setAjaxLoading();
-  ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function()
+  ajaxGet(stdAjaxPrefix + '&_mode=get_tags', function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1039,7 +1038,7 @@
   addtag_nukeme = nukeme;
   tag = ajaxEscape(tag);
   setAjaxLoading();
-  ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function()
+  ajaxPost(stdAjaxPrefix + '&_mode=addtag', 'tag=' + tag, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1111,7 +1110,7 @@
     if ( parentobj.nextSibling.nextSibling.firstChild.nodeValue == $lang.get('tags_btn_add_tag'))
       writeNoTags = true;
     
-  ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function()
+  ajaxPost(stdAjaxPrefix + '&_mode=deltag', 'tag_id=' + String(tag_id), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1159,7 +1158,7 @@
 
 window.ajaxPingServer = function()
 {
-  ajaxGet(stdAjaxPrefix + '&_mode=ping', function()
+  ajaxGet(stdAjaxPrefix + '&_mode=ping', function(ajax)
     {
     });
 }
@@ -1221,7 +1220,7 @@
   img.src = cdnPath + '/images/loading.gif';
   img.alt = 'Loading...';
   target.appendChild(img);
-  ajaxGet(makeUrlNS('Admin', 'Home/updates.xml'), function()
+  ajaxGet(makeUrlNS('Admin', 'Home/updates.xml'), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1441,7 +1440,7 @@
       mode: action,
       plugin: plugin_filename
     });
-  ajaxPost(makeUrlNS('Admin', 'PluginManager/action.json'), 'r=' + ajaxEscape(request), function()
+  ajaxPost(makeUrlNS('Admin', 'PluginManager/action.json'), 'r=' + ajaxEscape(request), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -1502,7 +1501,7 @@
   else var ipaddr = o.innerHTML;
   rDnsObj = o;
   rDnsBannerObj = bannerOn('Retrieving reverse DNS info...');
-  ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function() {
+  ajaxGet(stdAjaxPrefix+'&_mode=rdns&ip='+ipaddr, function(ajax) {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
         off = fetch_offset(rDnsObj);
--- a/includes/clientside/static/comments.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/comments.js	Sun Jan 25 20:35:06 2009 -0500
@@ -19,7 +19,7 @@
   if(comment_template)
     parms.have_template = true;
   parms = ajaxEscape(toJSONString(parms));
-  ajaxPost(stdAjaxPrefix+'&_mode=comments', 'data=' + parms, function() {
+  ajaxPost(stdAjaxPrefix+'&_mode=comments', 'data=' + parms, function(ajax) {
     if ( ajax.readyState == 4 && ajax.status == 200 ) {
       unsetAjaxLoading();
       selectButtonMajor('discussion');
--- a/includes/clientside/static/editor.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/editor.js	Sun Jan 25 20:35:06 2009 -0500
@@ -18,7 +18,7 @@
   setAjaxLoading();
   
   var rev_id_uri = ( revid ) ? '&revid=' + revid : '';
-  ajaxGet(stdAjaxPrefix + '&_mode=getsource' + rev_id_uri, function()
+  ajaxGet(stdAjaxPrefix + '&_mode=getsource' + rev_id_uri, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -581,7 +581,7 @@
   }
   
   json_packet = ajaxEscape(toJSONString(json_packet));
-  ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function()
+  ajaxPost(stdAjaxPrefix + '&_mode=savepage_json', 'r=' + json_packet, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -669,7 +669,7 @@
             editor_save_lock = false;
             enableUnload();
             changeOpac(0, 'ajaxEditContainer');
-            ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function()
+            ajaxGet(stdAjaxPrefix + '&_mode=getpage&noheaders', function(ajax)
               {
                 if ( ajax.readyState == 4 && ajax.status == 200 )
                 {
@@ -736,7 +736,7 @@
   {
     opacity('enano_editor_preview', 100, 0, 500);
   }
-  ajaxPost(stdAjaxPrefix + '&_mode=preview', 'text=' + ta_content, function()
+  ajaxPost(stdAjaxPrefix + '&_mode=preview', 'text=' + ta_content, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -761,7 +761,7 @@
 window.ajaxEditorRevertToLatestReal = function()
 {
   ajaxSetEditorLoading();
-  ajaxGet(stdAjaxPrefix + '&_mode=getsource', function()
+  ajaxGet(stdAjaxPrefix + '&_mode=getsource', function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -803,7 +803,7 @@
   {
     opacity('enano_editor_preview', 100, 0, 500);
   }
-  ajaxPost(stdAjaxPrefix + '&_mode=diff_cur', 'text=' + ta_content, function()
+  ajaxPost(stdAjaxPrefix + '&_mode=diff_cur', 'text=' + ta_content, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -982,7 +982,7 @@
   if ( !aed )
     return false;
   ajaxSetEditorLoading();
-  ajaxGet(stdAjaxPrefix + '&_mode=getsource&get_draft=1', function()
+  ajaxGet(stdAjaxPrefix + '&_mode=getsource&get_draft=1', function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
--- a/includes/clientside/static/functions.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/functions.js	Sun Jan 25 20:35:06 2009 -0500
@@ -105,16 +105,20 @@
     editor_open = false;
     enableUnload();
   }
-  ajax = ajaxMakeXHR();
+  var ajax = ajaxMakeXHR();
   if ( !ajax )
   {
     console.error('ajaxMakeXHR() failed');
     return false;
   }
-  ajax.onreadystatechange = f;
+  ajax.onreadystatechange = function()
+  {
+    f(ajax);
+  };
   ajax.open('GET', uri, true);
   ajax.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
   ajax.send(null);
+  window.ajax = ajax;
 }
 
 function ajaxPost(uri, parms, f, call_editor_safe) {
@@ -133,13 +137,16 @@
     editor_open = false;
     enableUnload();
   }
-  ajax = ajaxMakeXHR();
+  var ajax = ajaxMakeXHR();
   if ( !ajax )
   {
     console.error('ajaxMakeXHR() failed');
     return false;
   }
-  ajax.onreadystatechange = f;
+  ajax.onreadystatechange = function()
+  {
+    f(ajax);
+  };
   ajax.open('POST', uri, true);
   ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   // Setting Content-length in Safari triggers a warning
@@ -149,6 +156,7 @@
   }
   ajax.setRequestHeader("Connection", "close");
   ajax.send(parms);
+  window.ajax = ajax;
 }
 
 /**
--- a/includes/clientside/static/rank-manager.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/rank-manager.js	Sun Jan 25 20:35:06 2009 -0500
@@ -489,7 +489,7 @@
     rank_id: rank_id
   };
   json_packet = ajaxEscape(toJSONString(json_packet));
-  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function()
+  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -561,7 +561,7 @@
   /// ... pack it in
   var json_packet = ajaxEscape(toJSONString(json_packet));
   
-  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function()
+  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -718,7 +718,7 @@
   var rank_id = editor.rankdata.rank_id;
   
   json_packet = ajaxEscape(toJSONString(json_packet));
-  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function()
+  ajaxPost(makeUrlNS('Admin', 'UserRanks/action.json'), 'r=' + json_packet, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
--- a/includes/clientside/static/theme-manager.js	Sun Jan 25 20:27:14 2009 -0500
+++ b/includes/clientside/static/theme-manager.js	Sun Jan 25 20:35:06 2009 -0500
@@ -46,7 +46,7 @@
       theme_id: theme_id
     });
   // we've finished nukeing the existing interface, request editor data
-  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
+  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -121,7 +121,7 @@
           theme_id: theme_id
         });
       // we've finished nukeing the existing interface, request editor data
-      ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
+      ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function(ajax)
         {
           if ( ajax.readyState == 4 && ajax.status == 200 )
           {
@@ -484,7 +484,7 @@
       mode: 'uid_lookup',
       username: f_useradd.value
     });
-  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function()
+  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + ajaxEscape(req), function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -604,7 +604,7 @@
   
   // Request the save
   var parent = document.getElementById('ajaxPageContainer');
-  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function()
+  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {
@@ -638,7 +638,7 @@
   
   // Request the action
   var parent = document.getElementById('ajaxPageContainer');
-  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function()
+  ajaxPost(makeUrlNS('Admin', 'ThemeManager/action.json'), 'r=' + json_send, function(ajax)
     {
       if ( ajax.readyState == 4 && ajax.status == 200 )
       {