WEFEEL API can´t parse JSON data


Hi! i´m trying to request data from http://wefeel.csiro.au/api/emotions/primary/totals
it´s taken from this website http://wefeel.csiro.au/#/api

but it´s impossible for me, i´m new with javascript and programing in general.
can anybody help me please!!!!


You have to post your code, we can't spot the problem without seeing it.


here´s my code:
var infoURL = "http://wefeel.csiro.au/api/emotions/primary/totals";
var httpRequest = new XMLHttpRequest();

httpRequest.addEventListener("readystatechange", function() {
if (httpRequest.readyState == 4) {
var data = JSON.parse(httpRequest.responseText);
} );

httpRequest.open("GET", infoURL, true);

And this is my console log. i´m having trouble with CORS, and i don´t
really now how to solve it

XMLHttpRequest cannot load
http://wefeel.csiro.au/api/emotions/primary/totals. No
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access.


Server must allow CORS requests. If it does not - you have to solve this problem in a different way.

You can use service like cors.io by changing url of the request to http://cors.io/?u=http://wefeel.csiro.au/api/emotions/primary/totals.

Or you can create a simple server in the same origin which will take care of retrieving the data from the wefeel api and sending it to the client.

Do you know any server side language? I can help you with coding, but you must know some basic concepts.