Any idea what's the best way to get json from webhook to HTML? I already got to the step where I can print the json from the webhook and a json in script and It looks THE SAME but the one from webhook gives "undefined".
<body>
<h2>Print from Integromat</h2>
<p id="demo"></p>
<script>
let xhr = new XMLHttpRequest();
xhr.open("POST", "https://hook.integromat.com/xyxyxyxyxyxyxyxyxyx", true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function(e) {
// Error...
if (this.status != 200) return alert("Error")
// Success..
let json = JSON.stringify(this.response);
let text = "";
for(let i = 0; i < json.length; i++) {
let obj = json[i];
text += obj.firstname + "<br>";
text += obj.email + "<br><hr>"
}
document.getElementById("demo").innerHTML = text;
}
xhr.send(JSON.stringify({
//JSON to send
date: new Date(),
}));
</script>
</body>
Thanks a lot!