I\'m trying to create a website in HTML which recieves JSON-formatted data using javascript and, then it will be injecting that data into my website.
The problem is
If this code is not working correctly for you, there must be something else going on. Per this JSFiddle the code works fine.
Check to make sure you have a div with the id of output
in your HTML, and that you're actually including the script fetch.js
on your page. Check the JS console of your browsers developer tools for other errors.
Edit: Your CSS image placement and h1
tag attributes are causing the data to not be displayed correctly. If I change the h1
to h2
in your CSS, the headers (such as 'Big Ben') show up properly. However, as there is no scrolling for your div output
, and the image div img-cont img-1
and div front
are covering up part of your output
you won't ever see that entire text.
This is a CSS/layout issue, not a Javascript issue. Fix your CSS.