From bf0e3453018724f19e6305709b0b0ff997ce04c8 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Sun, 14 May 2017 23:50:09 -0300 Subject: [PATCH] Fix asynchronous calls with resetSettings The `resetSettings` function now returns the ajax object, allowing to chain other calls to it, e.g. the `getHistory` function. --- kfet/templates/kfet/kpsul.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 45416d06..7d943977 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -182,7 +182,7 @@ $(document).ready(function() { settings = {} function resetSettings() { - $.ajax({ + return $.ajax({ dataType: "json", url : "{% url 'kfet.kpsul.get_settings' %}", method : "POST", @@ -1431,9 +1431,10 @@ $(document).ready(function() { resetArticles(); resetPreviousOp(); khistory.reset(); - resetSettings(); - getArticles(); - getHistory(); + resetSettings().done(function (){ + getArticles(); + getHistory(); + }); } function resetSelectable() {