aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--public/index.html4
-rw-r--r--public/js/app.js22
2 files changed, 26 insertions, 0 deletions
diff --git a/public/index.html b/public/index.html
index abb347e..6e6333f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -7,5 +7,9 @@
</head>
<body>
<h1>Ramaskrik 2019</h1>
+ <div id="program">
+ <table id="screening-table">
+ </table>
+ </div>
</body>
</html>
diff --git a/public/js/app.js b/public/js/app.js
index 6f30a1f..6148be4 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -16,6 +16,14 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+function fetch_rooms(data_done) {
+ let req = new XMLHttpRequest()
+ req.addEventListener("load", data_done)
+ req.open("GET", "http://localhost:8000/rooms")
+ req.responseType = "json"
+ req.send()
+}
+
function load_screenings(data_done) {
let req = new XMLHttpRequest()
req.addEventListener("load", data_done)
@@ -42,10 +50,24 @@ function log_film(film) {
}
window.addEventListener("load", function() {
+ /*
load_screenings(function() {
this.response.forEach(function(film) {
log_film(film)
})
})
+ */
+ fetch_rooms(function() {
+ let table = document.getElementById("screening-table")
+ let row = document.createElement("tr")
+ table.appendChild(row)
+
+ this.response.forEach(function(room) {
+ console.log(room["name"])
+ let item = document.createElement("th")
+ item.innerHTML = room["name"]
+ row.appendChild(item)
+ })
+ })
console.log("Holahey!")
})