Stop AJAX when success or failure and show form on failure

AJAX requests stop on success or failure, as the waiting page
does not have to referesh any longer.

Also on failure a form that allows user to try again
is shown.
This commit is contained in:
Pea Tyczynska
2019-05-20 17:32:40 +01:00
parent 06ab7a5b1f
commit 6cf9959058
4 changed files with 45 additions and 6 deletions

View File

@@ -28,7 +28,12 @@
'data': form ? $('#' + form).serialize() : {}
}
).done(
response => flushQueue(queue, response)
response => {
flushQueue(queue, response);
if (response.stop === 1) {
poll = function(){};
}
}
).fail(
() => poll = function(){}
);