lundi 29 juin 2020

Root path of AJAX request in Ember.js app

I want to use ajax to load a file on the server as part of an ember application. I was originally using

fetch('filename.json').then((response) => response.json()).then((jsonResponse) =>  {
    this.service.use(jsonResponse);
});

Placing the filename.json file in public/assets, it was able to locate and load the file. However trying the same with

let response = await this.ajax.request('filename.json');
this.service.use(response.json());

doesn't work and can't locate the file. It is searching https://localhost/web/system/filename.json and 404s. In an ember application I'm not sure where the file should be located for it to find it. With ember how should I be loading a local file not meant to be served publicly?




Aucun commentaire:

Enregistrer un commentaire