I’m trying to add a .json file to my Grav site and access it via AJAX (JQuery), and I did what it says here:
- Created the twig file at /templates/myfile.json.twig.
- Put the JSON data into that twig file.
- Went to localhost/myfile.json.
- Browser says “Woops. Looks like this page doesn’t exist.”.
- But it shows up when I include it in base.html.twig, for example, with
{% include 'myfile.json.twig' %}
.
But I’d like to access the JSON file via AJAX, not as an include. How can I do that?
Please help.