Hi I'm new to javascript and API calls and I'm trying to make an API call using the following javascript code:
var url = 'https://labs.bible.org/api/?
passage=random&type=json&callback=myCallBackFcn';
var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', url);
ourRequest.onload = function(){
console.log(ourRequest.responseText);
};
ourRequest.send();
When I refresh my page I get the following error:
Failed to load https://labs.bible.org/api/?passage=random&type=json&callback=myCallBackFcn: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Can anyone help me with this? Also, can you explain exactly how to fix it?