From 9a0d90df7eb1fc4a5c594f46eff52f7c21092db0 Mon Sep 17 00:00:00 2001 From: Ling <59746573+ndbiaw@users.noreply.github.com> Date: Tue, 24 Oct 2023 23:32:31 +0700 Subject: [PATCH] (chore): ajax cache to reduce server load (#872) * Update index_datatables.js * Update common.js --- public/js/common.js | 1 + public/js/index_datatables.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/js/common.js b/public/js/common.js index e30b8261e..415983535 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -308,6 +308,7 @@ LRR.getImgSize = function (target) { $.ajax({ async: false, url: target, + cache: true, type: "HEAD", success: (data, textStatus, request) => { imgSize = parseInt(request.getResponseHeader("Content-Length") / 1024, 10); diff --git a/public/js/index_datatables.js b/public/js/index_datatables.js index 2ffb6bb95..7e60f909b 100644 --- a/public/js/index_datatables.js +++ b/public/js/index_datatables.js @@ -50,7 +50,10 @@ IndexTable.initializeAll = function () { IndexTable.dataTable = $(".datatables").DataTable({ serverSide: true, processing: true, - ajax: "search", + ajax: { + url: "search", + cache: true, + }, deferRender: true, lengthChange: false, pageLength: Index.pageSize,