Skip to content

Commit

Permalink
(chore): ajax cache to reduce server load (#872)
Browse files Browse the repository at this point in the history
* Update index_datatables.js

* Update common.js
  • Loading branch information
ndbiaw authored Oct 24, 2023
1 parent d8a9c26 commit 9a0d90d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion public/js/index_datatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9a0d90d

Please sign in to comment.