0

I have html page that I have on local machine and I loading it into chrome, using the following path

file:///C:/Siris/webpage/index.html

Now I am trying to access the REST interface that is running on my local machine. when I try to call getREST() from my button callback I am getting the following error.

XMLHttpRequest cannot load http://localhost:9000//ogre//reasoning//capabilities. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.

I have read that is because I am trying to go across domains.what my options for fixing this? Thanks

function getREST()
{


  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("demo").innerHTML =
      this.responseText;
    }
  };
  xhttp.open("GET", "http://localhost:9000//it/it2", true);
  xhttp.send();

}
user3470688
  • 539
  • 6
  • 21
  • "The response had HTTP status code 404" — This is because you got the URL wrong, not because you are trying to go across domains. – Quentin Sep 15 '16 at 16:19
  • I fixed the url and now I am getting this error : No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. – user3470688 Sep 15 '16 at 16:46

0 Answers0