From c9ac4d6545e65b6bc496605cb2f6af81422278ba Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Thu, 16 May 2024 21:07:07 +0200 Subject: [PATCH] created sample code for ajax --- res/forum/admin.html | 1 + res/forum/script.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 res/forum/admin.html create mode 100644 res/forum/script.js diff --git a/res/forum/admin.html b/res/forum/admin.html new file mode 100644 index 0000000..e5a60f1 --- /dev/null +++ b/res/forum/admin.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/res/forum/script.js b/res/forum/script.js new file mode 100644 index 0000000..0832ea1 --- /dev/null +++ b/res/forum/script.js @@ -0,0 +1,20 @@ +let script = document.createElement('script'); + +script.src = "https://code.jquery.com/jquery-3.7.1.min.js"; +script.integrity = "sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="; +script.crossOrigin = "anonymous"; + +document.getElementsByTagName('head')[0].appendChild(script); + +function show(file) +{ + $.ajax + ({ + url: "./res/forum/" + file + ".html", + dataType: "html", + success: function(data) + { + $("#main_panel").append(data); + } + }); +} \ No newline at end of file