diff --git a/ajax/ajax_contact_edit.php b/ajax/ajax_contact_edit.php index b0286cba..5a95d34f 100644 --- a/ajax/ajax_contact_edit.php +++ b/ajax/ajax_contact_edit.php @@ -1,14 +1,6 @@ 'Contact ID missing.']); - exit; -} +require_once '../includes/ajax_header.php'; $contact_id = intval($_GET['id']); @@ -332,12 +324,6 @@ ob_start(); - - $title, 'content' => $content]); +require_once "../includes/ajax_footer.php"; + ?> diff --git a/client_contact_details.php b/client_contact_details.php index 3b991a13..b741150f 100644 --- a/client_contact_details.php +++ b/client_contact_details.php @@ -156,7 +156,10 @@ if (isset($_GET['contact_id'])) {
-

@@ -213,7 +216,6 @@ if (isset($_GET['contact_id'])) {
-
diff --git a/client_contacts.php b/client_contacts.php index 3bff2bc5..dd010b2a 100644 --- a/client_contacts.php +++ b/client_contacts.php @@ -383,7 +383,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Make Note - Edit diff --git a/includes/ajax_footer.php b/includes/ajax_footer.php new file mode 100644 index 00000000..ec7400cc --- /dev/null +++ b/includes/ajax_footer.php @@ -0,0 +1,12 @@ + + + $title, 'content' => $content]); +?> \ No newline at end of file diff --git a/includes/inc_all_ajax.php b/includes/ajax_header.php similarity index 54% rename from includes/inc_all_ajax.php rename to includes/ajax_header.php index a70a7c1d..a4fb4e94 100644 --- a/includes/inc_all_ajax.php +++ b/includes/ajax_header.php @@ -5,3 +5,9 @@ require_once "../functions.php"; require_once "../check_login.php"; header('Content-Type: application/json'); + +// Check for the 'id' parameter +if (!isset($_GET['id'])) { + echo json_encode(['error' => 'ID missing.']); + exit; +} diff --git a/js/generic_modal_loader.js b/js/generic_modal_loader.js index e73d7dba..6643abe0 100644 --- a/js/generic_modal_loader.js +++ b/js/generic_modal_loader.js @@ -8,7 +8,7 @@ Edit Contact */ -$(document).on('click', '.ajax-trigger', function (e) { +$(document).on('click', '[data-toggle="ajax-modal"]', function (e) { e.preventDefault(); // Get the URL and ID from the element's data attributes. @@ -65,4 +65,4 @@ $(document).on('click', '.ajax-trigger', function (e) { alert('Error loading modal content.'); } }); -}); \ No newline at end of file +});