Added data-toggle='ajax-modal' to trigger the ajax modal instead, also added an ajax header and and footer to dedup code

This commit is contained in:
johnnyq
2025-02-15 14:50:48 -05:00
parent 298a584377
commit 9458c1cc7a
6 changed files with 29 additions and 23 deletions

12
includes/ajax_footer.php Normal file
View File

@@ -0,0 +1,12 @@
<script>// Initialize Select2 Elements
$('.select2').select2({
theme: 'bootstrap4',
});
</script>
<?php
$content = ob_get_clean();
// Return the title and content as a JSON response
echo json_encode(['title' => $title, 'content' => $content]);
?>

View File

@@ -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;
}