From 94bd891942b98345a48a72eb4315a2d1da063938 Mon Sep 17 00:00:00 2001 From: giuliof Date: Mon, 16 Jan 2023 21:43:49 +0100 Subject: [PATCH] [F.END] Changed zerocalcareTrigger to accept target div id as argument --- frontend/frontend.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/frontend.js b/frontend/frontend.js index 5208a76..20bc58e 100644 --- a/frontend/frontend.js +++ b/frontend/frontend.js @@ -1,7 +1,7 @@ "use strict" -function zerocalcareDisplay(xhr) { - let zerocalcareOutput = document.getElementById('zerocalcareOutput'); +function zerocalcareDisplay(xhr, target_id) { + let zerocalcareOutput = document.getElementById(target_id); if (xhr.readyState == 4 && xhr.status == 200) { @@ -141,12 +141,12 @@ function zerocalcareDisplay(xhr) { } } -function zerocalcareTrigger(url) { +function zerocalcareTrigger(url, target_id="zerocalcareOutput") { if (typeof url !== "string") return let xhr = new XMLHttpRequest(); - xhr.onload = () => { zerocalcareDisplay(xhr) }; + xhr.onload = () => { zerocalcareDisplay(xhr, target_id) }; xhr.open('GET', url, true); xhr.send(null); -} \ No newline at end of file +}