0

I am trying to access xml data through a link, but when I try to I get this error:

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

How can i fix this?

<!DOCTYPE html>
<html>
<body>
  <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
  <script type="text/javascript">
        $(document).ready(function(){
                $.ajax({
                  type: "GET",
                  url: "https://www.veiligstallen.nl/veiligstallen.xml",
                  dataType: "xml",
                  succes: function (xml){

                          console.log("succeed");

                });
        });



  </script>
</body>
</html>
lfurini
  • 3,729
  • 4
  • 30
  • 48
user3356007
  • 393
  • 1
  • 6
  • 20
  • This means that the remote server doesn't support CORS meaning that you cannot invoke it directly from your application using javascript. One possible workaround is to write a server side script on your domain that will act as a bridge between your and the remote domain. Then send the AJAX request to your own script: `url: "/proxy/veiligstallen.xml"` and the script will make the remote call and return the results. – Darin Dimitrov Jan 16 '17 at 16:15
  • Are you accessing this HTML file from the file system? In other words, if you look at the URL in your browser, do you see `file://`? If so, this is a duplicate of http://stackoverflow.com/q/4208530/215552. There are other duplicates if you are running from a server as well. Please do search before asking on Stack Overflow. See [ask]. – Heretic Monkey Jan 16 '17 at 16:19

0 Answers0