My XMLHttpRequest
Object is attempting to access a file located outside of its current folder.
According to W3Schools, modern browsers restrict access across domains for security purposes. Both the web page and the XML file being loaded must be on the same server.
In my case, the file is on the same server but in a different directory. Despite using "../" syntax to indicate that it's one level up from the folder, I'm unable to read the file. Is there a workaround for this issue?
The javascript file functions perfectly when the .xml file is in the same folder, yet I aim to access it from a higher directory - one level up. Using "xmlhttp.open("GET", "../myFile.xml", true);" doesn't grant access to the file.
1. Successfully loads myFile.xml from the current folder.
2. Fails to locate myFile.xml in the parent directory of the folder.
Even specifying the direct path doesn't work as expected.
[EDIT - Update] Issue resolved after transferring files to the host server from the desktop folder. Still unsure why there was a discrepancy between desktop environment and server, but relieved to know the code was correct.