d***@prosentient.com.au
2021-05-05 04:07:11 UTC
Hi all,
I was just reflecting on bugs like
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26942 and
reviewing https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
when I saw the following method for embedding JSON in HTML:
<!-- Generated by the server -->
<script id="data" type="application/json">{"userId":1234,"userName":"John
Doe","memberSince":"2000-01-01T00:00:00.000Z"}</script>
<!-- Static -->
<script>
const userInfo = JSON.parse(document.getElementById("data").text);
console.log("User information: %o", userInfo);
</script>
I thought that was neat.
David Cook
Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia
Office: 02 9212 0899
Online: 02 8005 0595
I was just reflecting on bugs like
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26942 and
reviewing https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
when I saw the following method for embedding JSON in HTML:
<!-- Generated by the server -->
<script id="data" type="application/json">{"userId":1234,"userName":"John
Doe","memberSince":"2000-01-01T00:00:00.000Z"}</script>
<!-- Static -->
<script>
const userInfo = JSON.parse(document.getElementById("data").text);
console.log("User information: %o", userInfo);
</script>
I thought that was neat.
David Cook
Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia
Office: 02 9212 0899
Online: 02 8005 0595