I am encountering an issue with adding the body content of a JSON file, which contains HTML code, to my existing HTML. Instead of executing the code, it appears as text within paragraph or header elements. I have searched through various discussions but have been unable to find a solution. Could someone please assist me in identifying what mistake I may be making?
<div id="title">
</div>
<div id="body">
</div>
<script>
var requestURL = 'https://secure.toronto.ca/cc_sr_v1/data/swm_waste_wizard_APR?limit=1000';
var request = new XMLHttpRequest();
request.open('GET', requestURL);
request.responseType = 'json';
request.send();
request.onload = function() {
var data = request.response;
document.getElementById("title").innerHTML = data[0].title;
document.getElementById("body").innerHTML = data[0].body;
}
</script>