From 71e70b2ef185da3a3d8f0a17463b4a8c68e6bd43 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 24 Nov 2016 16:59:14 +0800 Subject: 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. --- fg21sim/webui/static/js/configs.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fg21sim/webui/static') 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(); -- cgit v1.2.2