diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-24 16:59:14 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-24 16:59:14 +0800 |
commit | 71e70b2ef185da3a3d8f0a17463b4a8c68e6bd43 (patch) | |
tree | d34a223172f60cde4a24f2f232a9a82495c29fc3 | |
parent | ef4ffe1c5cb865e20b236192e1acf15fb36e4eed (diff) | |
download | fg21sim-71e70b2ef185da3a3d8f0a17463b4a8c68e6bd43.tar.bz2 |
webui: Replace jQuery.when() with jQuery.Deferred's .then()
Note that jQuery.when() can NOT promise the ordering of the passed
Deferred's. Therefore, chain multiple AJAX requests using ".then()" and
".done()" to keep them ordered.
This fixes the configurations loading problem on IE (v11), which calls
the "when()" arguments in different orders as Firefox and Chromium, thus
leads to the wrong results.
-rw-r--r-- | fg21sim/webui/static/js/configs.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js index f7419c9..a3d3be6 100644 --- a/fg21sim/webui/static/js/configs.js +++ b/fg21sim/webui/static/js/configs.js @@ -314,8 +314,8 @@ var resetConfigs = function (url) { // Server-side configurations already reset resetFormConfigs(); // Sync server-side configurations back to the client - $.when(getServerConfigs(url), - validateServerConfigs(url)) + getServerConfigs(url) + .then(function () { return validateServerConfigs(url); }) .done(function () { // Update the configuration status label updateFormConfigStatus(); @@ -499,9 +499,9 @@ $(document).ready(function () { $("#load-configfile").on("click", function () { var userconfig = getFormConfigSingle("userconfig"); resetFormConfigs(); - $.when(loadServerConfigFile(ajax_url, userconfig), - getServerConfigs(ajax_url), - validateServerConfigs(ajax_url)) + loadServerConfigFile(ajax_url, userconfig) + .then(function () { return getServerConfigs(ajax_url); }) + .then(function () { return validateServerConfigs(ajax_url); }) .done(function () { // Update the configuration status label updateFormConfigStatus(); |