diff --git a/src/_h5ai/client/js/inc/core/resource.js b/src/_h5ai/client/js/inc/core/resource.js index 44675880..68d1b1f5 100644 --- a/src/_h5ai/client/js/inc/core/resource.js +++ b/src/_h5ai/client/js/inc/core/resource.js @@ -37,10 +37,12 @@ modulejs.define('core/resource', ['_', '$', 'config', 'core/settings'], function loadScript = function (filename, callback) { $.ajax({ - url: scriptsHref + filename, - dataType: 'script', - complete: function () { callback(); } - }); + url: scriptsHref + filename, + dataType: 'script' + }).done(function () { + + callback(); + }); }, loadScriptGlob = function (filename, globalId, callback) { diff --git a/src/_h5ai/client/js/inc/core/server.js b/src/_h5ai/client/js/inc/core/server.js index ba215526..becc9b96 100644 --- a/src/_h5ai/client/js/inc/core/server.js +++ b/src/_h5ai/client/js/inc/core/server.js @@ -12,19 +12,19 @@ modulejs.define('core/server', ['$', '_', 'config', 'core/location'], function ( if (server.api) { $.ajax({ - url: location.getAbsHref(), - data: data, - type: 'POST', - dataType: 'json', - success: function (json) { + url: location.getAbsHref(), + data: data, + type: 'POST', + dataType: 'json' + }) + .done(function (json) { callback(json); - }, - error: function () { + }) + .fail(function () { callback(); - } - }); + }); } else { callback(); } diff --git a/src/_h5ai/client/js/inc/ext/preview-txt.js b/src/_h5ai/client/js/inc/ext/preview-txt.js index d6f4f572..794f4226 100644 --- a/src/_h5ai/client/js/inc/ext/preview-txt.js +++ b/src/_h5ai/client/js/inc/ext/preview-txt.js @@ -49,18 +49,18 @@ modulejs.define('ext/preview-txt', ['_', '$', 'markdown', 'core/settings', 'core preloadText = function (absHref, callback) { $.ajax({ - url: absHref, - dataType: 'text', - success: function (content) { + url: absHref, + dataType: 'text' + }) + .done(function (content) { callback(content); // setTimeout(function () { callback(content); }, 1000); // for testing - }, - error: function (jqXHR, textStatus, errorThrown) { + }) + .fail(function (jqXHR, textStatus, errorThrown) { callback('[ajax error] ' + textStatus); - } - }); + }); }, onEnter = function (items, idx) { diff --git a/src/_h5ai/client/js/scripts.js b/src/_h5ai/client/js/scripts.js index c6ed3177..8b45ee69 100644 --- a/src/_h5ai/client/js/scripts.js +++ b/src/_h5ai/client/js/scripts.js @@ -51,12 +51,11 @@ if (window.attachEvent && !window.addEventListener) { throw 'no-browser'; } url: url, data: {action: 'get', setup: true, options: true, types: true, theme: true, langs: true}, type: 'POST', - dataType: 'json', - success: function (config) { + dataType: 'json' + }).done(function (config) { - modulejs.define('config', config); - $(function () { modulejs.require(module); }); - } + modulejs.define('config', config); + $(function () { modulejs.require(module); }); }); }());