From 22061edc0c0642ebd74126468e385911d5adbee9 Mon Sep 17 00:00:00 2001 From: Rajat Jain Date: Sat, 19 Sep 2020 22:28:39 +0530 Subject: [PATCH] fixed async Routine export Signed-off-by: Rajat Jain --- js/src/rte.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/js/src/rte.js b/js/src/rte.js index 2563f41295..ab8d05b666 100644 --- a/js/src/rte.js +++ b/js/src/rte.js @@ -131,23 +131,26 @@ RTE.COMMON = { if (count === 0) { Functions.ajaxShowMessage(Messages.NoExportable); } - + var p = $.when(); exportAnchors.each(function () { - $.get($(this).attr('href'), { 'ajax_request': true }, function (data) { - returnCount++; - if (data.success === true) { - combined.message += '\n' + data.message + '\n'; - if (returnCount === count) { - showExport(combined); + var h = $(this).attr('href'); + p = p.then(function () { + return $.get(h, { 'ajax_request': true }, function (data) { + returnCount++; + if (data.success === true) { + combined.message += '\n' + data.message + '\n'; + if (returnCount === count) { + showExport(combined); + } + } else { + // complain even if one export is failing + combined.success = false; + combined.error += '\n' + data.error + '\n'; + if (returnCount === count) { + showExport(combined); + } } - } else { - // complain even if one export is failing - combined.success = false; - combined.error += '\n' + data.error + '\n'; - if (returnCount === count) { - showExport(combined); - } - } + }); }); }); } else {