From 0e56eb3e3a041b34799b03bf6e381b37f8eba9b9 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sat, 13 May 2023 15:12:05 +0100 Subject: [PATCH] Fix delete --- lib/js/nb.js | 6 +++++- lib/php/db/table.php | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/js/nb.js b/lib/js/nb.js index 73fb8cdb..e2db5637 100644 --- a/lib/js/nb.js +++ b/lib/js/nb.js @@ -640,11 +640,15 @@ jQuery.fn.href2delete = function(minus_one,minus_one_re) { // NB 13.05.23 $(this).parent().parent().remove(); $.ajax({ url: href, - type: 'DELETE', + type: 'GET', success: function(result) { if (minus_one) $(minus_one).numAdd(-1,minus_one_re); $(this).parent().parent().remove(); $(this).removeClass('loading'); + }, + error: function (xhr, status, error) { + $(this).removeClass('loading'); + alert(status+' '+xhr.status+' '+error); } }); }); diff --git a/lib/php/db/table.php b/lib/php/db/table.php index e0673e49..1468c356 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -2032,7 +2032,13 @@ Class Table extends nb { return $this->out($this->info()); } elseif ($action == 'table.delete') { - if (!$this->delete($_POST,$e) and !isset($e['rowCount'])) bye($e); + # NB 13.05.23: Query could be GET from js + $params = ($_SERVER['REQUEST_METHOD'] == 'GET') + ? $_GET + : $_POST + ; + #debug($params); + if (!$this->delete($params,$e) and !isset($e['rowCount'])) bye($e); $this->db()->print_header('Location',$this->url_referer(str_replace('&','&',$this->url_list()))); $this->out($e); return true; -- 2.47.3