Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript: Three.js JSON error on remote server, but not on local
    primarykey
    data
    text
    <p>I'm writing a Three.js application. In part of it, I load a blender model exported as a JSON file using the <a href="https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender" rel="nofollow">Blender->JSON exporter</a> for Three.js. I have WAMPServer 2.2 configured on my local computer (Windows 7) that I use to test my website before I FTP it to the remote server to show off to friends and such.</p> <p>Loading this JSON file works fine on the local test server, but when I upload it to the server, I get the following error in Firebug, Firefox 16.0.2:</p> <pre><code>SyntaxError: JSON.parse: unexpected character var json = JSON.parse( xhr.responseText ); three.js (line 7810) </code></pre> <p>It's finding the JSON file fine - the GET shows up in Firebug. The loading of the model is, as far as I can tell, the only loading of JSON I have in the entire script; the model also doesn't show up remotely, where it does locally. Here's the function with the load in it:</p> <pre><code>//Adds a unit to the scene. Assumes Init() hasn't been called on the unit yet. function pubAddUnit(unit, coord, modelSrc) { //Do whatever initialization the unit has to do unit.Init(); //Store the unit in its position on the grid units[coord.y][coord.x] = unit; //Load the unit model var loader = new THREE.JSONLoader(); loader.load(modelSrc, //Function called once the unit model is loaded function(geometry) { //Create a new material for the unit var material = new THREE.MeshFaceMaterial(); var mesh = new THREE.Mesh(geometry, material); //Store the unit geometry and mesh into their respective grids unit.SetGeo(geometry); unit.SetMesh(mesh); //Move the mesh to the correct spot mesh.position = TransCoord2(coord); mesh.scale.set(40, 40, 40); //Add the mesh to the scene scene.add(mesh); //Update the scene, now with the mesh in update(); }); } </code></pre> <p>And <a href="http://www.inarticulateloquence.com/daGame/threetest.php" rel="nofollow">here's the javascript file</a>, as showing on the remote server. Any ideas on why this is happening is appreciated.</p> <hr> <p>EDIT: I'm using FileZilla to FTP. I did suddenly notice that the filesize of the JSON file on the server differs from that of the local, but I'm not sure if that's something I need to worry about or not - perhaps it's line endings or something?</p> <hr> <p>Also, <a href="http://pastebin.com/ZiBF4sgW" rel="nofollow">here is the JSON file</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload