forked from thecuriousteam/PyLibLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogic.js
More file actions
44 lines (39 loc) · 1.36 KB
/
logic.js
File metadata and controls
44 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// function showContent(content) {
// var contentDiv = document.getElementById('content');
// // Create a function to load content from an HTML file
// function loadContentFromFile(filename) {
// var xhr = new XMLHttpRequest();
// xhr.onreadystatechange = function() {
// if (xhr.readyState === 4 && xhr.status === 200) {
// contentDiv.innerHTML = xhr.responseText;
// }
// };
// xhr.open('GET', filename, true);
// xhr.send();
// }
// // Use a switch statement to determine which content to load
// switch (content) {
// case 'Django':
// loadContentFromFile('Django.html');
// break;
// case 'Flask':
// loadContentFromFile('about.html');
// break;
// case 'contact':
// loadContentFromFile('contact.html');
// break;
// default:
// contentDiv.innerText = 'Content not found';
// }
// }
function showContent(contentFileName) {
var contentDiv = document.getElementById('content');
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
contentDiv.innerHTML = xhr.responseText;
}
};
xhr.open('GET', contentFileName, true);
xhr.send();
}