From a9eb32217f35805c5a9901372c6d7ae20a228a1d Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Tue, 15 Sep 2020 20:05:32 +0200 Subject: [PATCH] Adapte history.js pour serialize() --- kfet/static/kfet/js/history.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index 540c8239..06b10d17 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -205,17 +205,21 @@ function KHistory(options = {}) { $group.find('.amount').text(amount); } - this.fetch = function (fetch_options) { - options = $.extend({}, this.fetch_options, fetch_options); - var that = this; + this.fetch = function (fetch_options = {}) { + if (typeof (fetch_options) == "string") + data = fetch_options + else + data = $.extend({}, this.fetch_options, fetch_options); + return $.ajax({ + context: this, dataType: "json", url: django_urls["kfet.history.json"](), - method: "POST", - data: options, + method: "GET", + data: data, }).done(function (data) { for (let group of data['groups']) { - that.add_history_group(group); + this.add_history_group(group); } }); }