Error with Three.js JSON file occurs when trying to load the file from a remote server, yet the error

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.

Answer №1

After some investigation, I uncovered the root of the issue. It appears that instead of receiving the expected JSON file, the server is responding with a message stating "hacked by hacker". Upon closer examination of the GET response, it became evident that all requests from the site are being diverted to this compromised file. While this discovery falls beyond the initial scope of the inquiry, I am open to any insights or assistance that others may offer in rectifying this situation.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I successfully developed a Microsoft Azure Function that pulls data from a weather API and saves it to a MYSQL database. However, I encountered some difficulties while trying to create a

After successfully developing a Microsoft Azure Function app that retrieves and processes data from a weather API, I faced the challenge of storing this data in Microsoft Azure's MySQL database/server. Now, my goal is to create a new API that can extr ...

Access a different tab through the utilization of JavaScript functions

Hi everyone, I recently created tabs using bootstrap, but I am facing a challenge with a specific scenario. I need the active tab to switch to another tab when a submit button is clicked. <div id="checkout-progress"> <ul class="nav nav-tabs"& ...

Determining if a path is within the same directory: a step-by-step guide

I need to check if the input path is located in the same folder or not Question: Is the input path in the same folder? For example, if my current path is f://learning/java and I am currently in a folder named java, then any path that directly belongs to ...

Obtaining Local JSON data in a standard Flutter class

In the Services-> math_logic.dart file, I have a page dedicated to mathematical calculations where I did not use StateFul Widget. However, I encountered an error indicating that 'Future is not a subtype of String'. It seems that there was also ...

Tips for safely executing an SQL query with electron.js

I have a new project where I need to interact with an SQL database on the local network, but it's not located on the same system I'm working on (not SQLExpress). So far, I've figured out how to collect user input on a webpage and send that ...

Creating a Select Box in React with Dynamic Value Options

I am a beginner in React and I am attempting to populate the select box with a dynamic object. The code: import React, { useEffect, useState, setState } from "react"; const selectBoxWrapper = () => { const [thisdata, setData] = useState([ ...

Unable to translate the Json String into Java objects

I'm facing difficulties in converting the Json String to a Java Object After validating the Json format, it appears to be correct. @JsonIgnoreProperties(ignoreUnknown = true) public class DevPol { private String id; private Header header; ...

What is the best way to delete a property from an object in an array?

I have a Vue component with an array that includes IDs which I want to remove while keeping the other elements intact. Is there a way to achieve this within a method? Is it possible to filter out the ID index from the array using Vue methods? var vm = ...

What is the best way to display Json data in a UITableView using Swift 4?

My code structure looks something like this: struct Excercise: Codable { let excerciseID: String let excerciseName: String let description: String let intensity: Int } Next, I have the variable defined as: var excercistList = [Excercis ...

Exploring the Steam Web API: A Comprehensive Guide to Retrieving a List of Items for Specific Game IDs (570, 440, 730, 753) Along With Tags and Descriptions

Is it possible to retrieve all items along with their tags such as (Rarity, Quality, Hero, Slot, Type, Description) for DOTA2 (570), TF2 (440), CS:GO (730), Steam (753) I have been unsuccessful in finding an API that can provide a response containing al ...

Encountered an issue while parsing Json in swift: unable to convert value of type 'NSNull' to 'NSString'

In my code, I have defined a class called `BannerResponse` that looks like this: class BannerResponse : NSObject{ let URL = "Url"; let CONTACT_NO = "ContactNo"; let IMAGE = "Image"; let BIG_IMAGE ...

Exploring ways to retrieve data from a JSON object in Flutter

For testing purposes, I am looking to access and display the properties of a json object on the screen. To showcase the entire json object on the screen: { "2021": { "januari": { "value": 100, ...

Working with JSON responses in ASP.NET

Being a PHP Developer with limited knowledge of asp, I am working on a portal in PHP that requires an ajax post to an asp page on an external server. The response from the asp page is formatted like this: OK|some_id|some_name|some_id|0|1|||some_name|some_ ...

three.js: shadows created by a mesh with varying levels of transparency

My model has a texture with certain transparent areas (alpha equals zero). But when the model casts a shadow, it looks like it's solid. Is there a way to solve this issue? ...

Could someone kindly clarify the workings of this jQuery script for me?

I found this code online, but I'm struggling to comprehend its functionality. In order to make any edits for my needs, I need to understand how it operates. The purpose of this script is to close a panel with an upward slide animation when the "x" but ...

Converting Temperature between Celsius and Fahrenheit using a Dropdown Menu

I am trying to create a conversion tool using a Select menu. The idea is that the first input box will display the temperature unit selected in the menu, but for some reason it's not working as expected. If I choose Celsius from the menu, then the inp ...

Issue with AjaxComplete function failing to work

Currently, I am tackling the Opera workaround for printing IFrames. As we are aware, the only method to print an IFrame is by opening it in a new window and then printing it. However, I am encountering an issue where a series of ajax calls are triggered wh ...

Can I compile a build using browserify/babel for a specific browser version?

After reviewing compatibility tables, like the one found at , it appears that Chrome is on the verge of fully supporting ES6. This leads me to believe that I can omit certain elements during development. var babelifyOptions = { presets: ['es2015& ...

JavaScript Processing Multiple Input Values to Produce an Output

Hello, I am working on creating a stamp script that will allow users to enter their name and address into three fields. Later, these fields will be displayed in the stamp edition. Currently, I have set up 3 input fields where users can input their data. He ...

Utilizing PHP to add numerous markers on Google Maps

I've been searching through various resources and forums but haven't been able to find a solution for my specific situation. I'm currently learning PHP and Javascript, so my code might not be perfect, but here is what I have: So far, I have ...