Hi so I keep on getting this uncaught (in promise) error when I try to load a JSON file using JavaScript fetch API and I have no Idea why can anyone help me please? Here is my code:
next_arrow();
function next_arrow(){
const next_arrow = document.querySelector('.next');
next_arrow.addEventListener('click', () => {
fetch('topic.json')
.then(
(res) => res.json()
)
.then(
(data) => console.log(data)
)
})
};
Here is the content of the JSON file I'm trying to fetch:
[{"Topic": "Phone or Web"}, {"Topic": "Time or Money"}, {"Topic": "Power or Wisdom"}, {"Topic": "Luxure or Camp!"}]