From 345dd1bc20928e25dc72befb705502156e47f1d7 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Wed, 11 Jun 2025 21:20:08 +0300 Subject: [PATCH] feat: Add console log for ajax actions when explain cookie is set (#1940) --- src/Ajax.php | 5 +++++ styles/js/main.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Ajax.php b/src/Ajax.php index e8e2960f9..84856a367 100644 --- a/src/Ajax.php +++ b/src/Ajax.php @@ -176,6 +176,11 @@ class Ajax { $this->response['action'] = $this->action; + // Show ajax action in console log + if (!empty($_COOKIE['explain'])) { + $this->response['console_log'] = 'ajax action: ' . $this->response['action']; + } + if (Dev::sqlDebugAllowed()) { $this->response['sql_log'] = Dev::getSqlLog(); } diff --git a/styles/js/main.js b/styles/js/main.js index 6c6f5489c..a9271fc15 100644 --- a/styles/js/main.js +++ b/styles/js/main.js @@ -343,12 +343,14 @@ Ajax.prototype = { } } else if (response.error_code) { ajax.showErrorMsg(response.error_msg); - console.log(response.console_log); $('.loading-1').removeClass('loading-1').html('error'); } else { ajax.callback[action](response); ajax.clearActionState(action); } + if (response.console_log) { + console.log(response.console_log); + } }, error: function (xml, desc) {