[F.END] Changed zerocalcareTrigger to accept target div id as argument
This commit is contained in:
parent
c99ffd7b16
commit
94bd891942
|
@ -1,7 +1,7 @@
|
||||||
"use strict"
|
"use strict"
|
||||||
|
|
||||||
function zerocalcareDisplay(xhr) {
|
function zerocalcareDisplay(xhr, target_id) {
|
||||||
let zerocalcareOutput = document.getElementById('zerocalcareOutput');
|
let zerocalcareOutput = document.getElementById(target_id);
|
||||||
|
|
||||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
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")
|
if (typeof url !== "string")
|
||||||
return
|
return
|
||||||
|
|
||||||
let xhr = new XMLHttpRequest();
|
let xhr = new XMLHttpRequest();
|
||||||
xhr.onload = () => { zerocalcareDisplay(xhr) };
|
xhr.onload = () => { zerocalcareDisplay(xhr, target_id) };
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
}
|
}
|
Loading…
Reference in New Issue