madhurhtml5 Posted April 25, 2014 Share Posted April 25, 2014 Hi,i am trying the example of p2 physics i.e contact event . As i have develop complete game where i am loading all the game image and json file in loading screen. It load only image and giving error for json file . Error in console is :GET http://localhost/alphadefender/assests/physics/sprites.json 404 (Not Found) phaser.js:41968Uncaught SyntaxError: Unexpected token < I have provided correct path of json file and also running the file on localhost .Secondly , the syntax i have use for loading the json file is: game.load.physics('physicsData','assests/physics/sprites.json'); plz help me out ... Link to comment Share on other sites More sharing options...
Luiz Bills Posted April 25, 2014 Share Posted April 25, 2014 How is your project structure? Link to comment Share on other sites More sharing options...
clark Posted April 26, 2014 Share Posted April 26, 2014 Can you pass your JSON file through this? http://jsonlint.com/ < looks like a bad syntax error. Link to comment Share on other sites More sharing options...
mwatt Posted May 6, 2014 Share Posted May 6, 2014 I am having the exact same symptoms, although I am loading the JSON file via load.atlas. The odd thing is, in WAMP on my local machine, my code runs fine. Only when I put my code on an external server (it uses IIS 8), do I experience the problem. I did try forcing the JSON file format to PC UTF-8. Link to comment Share on other sites More sharing options...
mwatt Posted May 6, 2014 Share Posted May 6, 2014 I should also note that my JSON file passes the lint test. Anyone? Link to comment Share on other sites More sharing options...
Manifest Posted May 6, 2014 Share Posted May 6, 2014 Have you tried explicitly telling the webserver to host .json files? They don't host them by default. My web.config has this addition: <system.webServer> <staticContent> <mimeMap fileExtension=".json" mimeType="application/json"/> </staticContent> </system.webServer> Link to comment Share on other sites More sharing options...
mwatt Posted May 8, 2014 Share Posted May 8, 2014 Thank you Manifest. The web.config file solved the problem. Link to comment Share on other sites More sharing options...
Recommended Posts