0

Error: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Here is the getJSON call

var fewd = {
  getJSON: function(url, success) {
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
      if (xhr.readyState == 4 && xhr.status == 200) {
        var json = JSON.parse(xhr.response);
        success(json);
      }
    }
    xhr.open("GET", url);
    xhr.send();
  },
};

What should be added here to fix this issue. I read through all the previous bugs but cannot figure out exactly what should be added here.

dave
  • 62,300
  • 5
  • 72
  • 93
  • Dupe of http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin? – Albert Xing Jun 17 '14 at 21:06

1 Answers1

0

There is nothing you can add here to fix it but what you have to do is find a way to not send that head in http request via url. Either by configuring your server or finding a service that does this.

Research CORS

Muhammad Umer
  • 17,263
  • 19
  • 97
  • 168