So far my program used a .json-file to plot a diagram. Code was something like this:
d3.json("data.json", function(data) {
//use data
});
This worked perfectly fine. The data in .json-file comes from my own REST-service which is running in NetBeans. For the moment I just copied and pasted the output of my REST-service-call into the .json file (located in the folder where also the index.html is) and saved it. As this is just a dumb way to do it, I want my JavaScript to call my REST-service and use the retrieved data instead of the .json-file. So I tried something like this:
d3.json('http://localhost:port/data', function(data) {
//use data
});
(the url is obviously just a dummy) Checking the NetBeans-networkmonitor , it's always a GET request with status 200 which should be fine, I guess. The response headers contain "content-type: application/json" and the response itself is the exact same data I'd receive if I just call the url in my browser (from which I copy-pasted them into the .json-file before -> no difference in data). Problem is: the diagram is just not shown anymore. If I run the hmtl with the "file"-code it works, if I run it with the "call Rest-service"-code, it doesn't show anything anymore. Has anybody an idea why this is happening?
Interesting thing is that the response code from my rest-service is red and there's no content-type in the NetBeans network-monitor (screenshot).
Edit1: the table from the screenshot does not show a content-type although the response headers say "Content-type: application/json".