reference

This commit is contained in:
SowinskiBraeden committed 2025-03-18 22:46:53 -07:00
commit aff3c348c4
908 files changed
+93185

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
function loadCourses() {
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
document.getElementById("coursesTarget").innerHTML =
this.responseText;
}
xhttp.open("GET", "api/courses");
xhttp.send();
}
async function loaddata() {
let response = await fetch("/api/stuff").then(response => response.json());
console.log(response);
}
loadCourses();
+18
View File
@@ -0,0 +1,18 @@
function loadCourse() {
let url = window.location.href;
let id = url.split("/")[url.split("/").length - 1];
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
let course = JSON.parse(this.response);
document.getElementById("title").innerHTML = `${course.department} ${course.id}`;
document.getElementById("crsID").innerHTML = `${course.department} ${course.id}`;
document.getElementById("crsName").innerHTML = course.name;
document.getElementById("crsDes").innerHTML = course.description;
document.getElementById("crsCredits").innerHTML = course.credits;
}
xhttp.open("GET", `/api/course/${id}`);
xhttp.send();
}
loadCourse();