So my goal is to retrieve a JSON file to parse and assign to a variable. I started with my idea to use XMLHttpRequest, but then switched to using fetch. The problem is it's converting my relative file path to an HTTP request. With our setup (its part of an ember application) since that's not an actual page, it returns a 404 page and thus the response is all the HTML of that page.
fetch('../folder/myobject.json'){
.then(function(response) {
return response.json();
}) ... so on
Is there a way to specify to not make a HTTP call with fetch or just another way to retrieve a file that is part of the app?
Aucun commentaire:
Enregistrer un commentaire