Currently, I am developing a Three.js application. One part of the project involves loading a blender model that has been exported as a JSON file using the Blender->JSON exporter specifically designed for Three.js. To test my website before deploying it onto the remote server, I have set up WAMPServer 2.2 on my local Windows 7 computer.
When loading this JSON file on my local test server, everything works perfectly fine. However, once uploaded to the remote server, I encounter an error in Firebug (Firefox 16.0.2) stating:
SyntaxError: JSON.parse: unexpected character
var json = JSON.parse( xhr.responseText );
three.js (line 7810)
The GET request for the JSON file is successful and displays in Firebug, but the model does not appear remotely as it does locally. The function responsible for loading the model is as follows:
// Function to add a unit to the scene
function pubAddUnit(unit, coord, modelSrc)
{
// Initialization of the unit
unit.Init();
// Storing the unit on the grid
units[coord.y][coord.x] = unit;
// Loading the unit model
var loader = new THREE.JSONLoader();
loader.load(modelSrc,
function(geometry) {
var material = new THREE.MeshFaceMaterial();
var mesh = new THREE.Mesh(geometry, material);
unit.SetGeo(geometry);
unit.SetMesh(mesh);
mesh.position = TransCoord2(coord);
mesh.scale.set(40, 40, 40);
scene.add(mesh);
update();
});
}
You can view the javascript file here on the remote server. Any insights into why this issue might be occurring would be greatly appreciated.
UPDATE: I use FileZilla for FTP transfers. Upon closer inspection, I noticed a discrepancy in the filesize of the JSON file between the local and remote servers. Could this be due to line endings or some other factor?
Furthermore, you can access the JSON file here.