I'm trying to read an XML file using JQuery... Or at the very least, I'm trying to access it. I have a file system made like this :
-> Main directory
-> html
-> home.html
-> js
-> jquery.js
-> XMLReader.js (made it myself)
-> XML
-> test.xml
XMLReader.js is made like this :
'use strict'
$(document).ready(function()
{
$.ajax(
{
type: "GET",
url: "../xml/test.xml",
//async: false,
dataType: "xml",
success: function(xml)
{
console.log("ayy");
}
});
});
When I try to reach my XML file located in my xml folder, my request keeps getting blocked by CORS policy (when I am trying to access a LOCAL file !). On the other hand, if I put all the files in the same directory (and change the links of course), it works.
Basically, CORS policy is preventing me from organising my local web application.
Is there a way to solve this ? CORS Policy shouldn't be blocking me for trying to read a local file, right ?
See Question&Answers more detail:os