fixed async Routine export

Signed-off-by: Rajat Jain <rajatjain.ix@gmail.com>
This commit is contained in:
Rajat Jain 2020-09-19 22:28:39 +05:30
parent a7c9d65d4c
commit 22061edc0c

View File

@ -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 {