node.js - ReactJS: JSON file is fetched from localhost instead of project directory -
i have following directory structure of project. i have following code in index.js file loading website.json file. index.js componentdidmount() { $.ajax({ url: "../website.json", type: "get", datatype: 'json', contenttype: 'application/json', success: function(data) { this.setstate({data: data}); console.log(data); }.bind(this), error: function(jqxhr) { console.log(jqxhr); }.bind(this) }) } the problem using npm start command server react app local directory of application. serves app @ http://localhost:3000/ . problem application tries load website.json file http://localhost:3000/website.json gives 404 not found error. so, question how website.json file can loaded project directory instead of localhost. note: project folder not @ localhost @ virtual host. update: asking why ajax call unable load data project folder (i us...