javascriptjqueryjsoncraftyjs

JSON File Not Returned on GET Request


I am using the Craftyjs game engine, and in a javascript file locaed in the public directory, which is correctly hooked up with html, I am requesting a JSON file as such:

var map = Crafty.e('TiledLevel').tiledLevel('/crafty/scripts/tiles.json');

In the console, a 404 error appears.

Here is the file directory. Everything under public/ can be requested directly.

public/
   crafty/
      scripts/
         tiles.json

jQuery is doing the requesting in the background.

How come the JSON file cannot be found? How can I fix it?

I have looked up the question "Node GET request for json file not working," but the file I am working in has no node in it.

The request is going to the server (vs going to local filesystem).


Solution

  • Turns out I had named my file tiles..json instead of tiles.json. I checked again in the Network tag and found that it loaded with a 200 - OK. Thank's for that tip @yuriy646.