diff options
author | Justin Choquette <jchoquette@iol.unh.edu> | 2023-09-27 17:03:38 -0400 |
---|---|---|
committer | Justin Choquette <jchoquette@iol.unh.edu> | 2023-10-19 18:10:17 -0400 |
commit | aff53e072502d63d8002d9c83213ce7f9d12c352 (patch) | |
tree | 3a30adca1fe7c958ddc092dbf7b9fa24259dd923 /src/templates/base/booking/booking_detail.html | |
parent | 1947d40115c7b13f8617ea92078a6f910d6bc799 (diff) |
user subsystem clean up
Change-Id: Ia59bb7c1e4412693f55cdcaf9607bcb4158850ae
Signed-off-by: Justin Choquette <jchoquette@iol.unh.edu>
Diffstat (limited to 'src/templates/base/booking/booking_detail.html')
-rw-r--r-- | src/templates/base/booking/booking_detail.html | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/templates/base/booking/booking_detail.html b/src/templates/base/booking/booking_detail.html index bcf554b..0ae6530 100644 --- a/src/templates/base/booking/booking_detail.html +++ b/src/templates/base/booking/booking_detail.html @@ -169,28 +169,32 @@ code { </div> <script> + const agg_id = "{{booking.aggregateId}}" setInterval(function () { fetchBookingStatus(); }, 5000); async function fetchBookingStatus() { - req = new XMLHttpRequest(); - var url = "status"; - req.open("GET", url, true); - req.onerror = function () { console.log("failed to get status") } - req.onreadystatechange = function () { - if (req.readyState === 4) { - let status = JSON.parse(req.responseText) - updateStatuses(status) - } - } - req.send(); + data = {"agg_id": agg_id} + $.ajax({ + url: '', + type: 'post', + data: JSON.stringify(data), + headers: { + 'X-CSRFToken': document.getElementsByName('csrfmiddlewaretoken')[0].value, + 'Content-Type': 'application/json' + }, + dataType: 'text', + }) + .done(function(response) { + updateStatuses(response) + }) } async function updateStatuses(status) { - const instances = status.instances; + if (!instances) return; Object.keys(instances).forEach((aggId) => { const instance = instances[aggId] |