From caa7b4429e68135404ad5a01aa1d7f530abae090 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 28 Apr 2019 13:47:58 +0200 Subject: Update /screenings endpoint to return full info on screenings. This makes each screening record self-contained, and the json payload more consistent with how it semantically fit together. --- public/js/app.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'public') diff --git a/public/js/app.js b/public/js/app.js index 6148be4..c6899a7 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -27,7 +27,7 @@ function fetch_rooms(data_done) { function load_screenings(data_done) { let req = new XMLHttpRequest() req.addEventListener("load", data_done) - req.open("GET", "http://localhost:8000/screenings.json") + req.open("GET", "http://localhost:8000/screenings") req.responseType = "json" req.send() } @@ -50,13 +50,13 @@ function log_film(film) { } window.addEventListener("load", function() { - /* load_screenings(function() { - this.response.forEach(function(film) { - log_film(film) + console.log(this.response) + this.response.forEach(function(screening) { + console.log(screening.film.title + "@" + screening.room.name + ": " + screening.date) }) }) - */ + fetch_rooms(function() { let table = document.getElementById("screening-table") let row = document.createElement("tr") -- cgit v1.2.3