I'm developing an excel Addin and I'm trying to access to a remote json file.
In Home.js I added the following rows
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var myObj = JSON.parse(this.responseText);
document.getElementById("demo").innerHTML = myObj.name;
}
};
xmlhttp.open("GET", "http://www.supercolored.com/demo.txt", true);
xmlhttp.send();
In Home.html I added the following line:
<p class="ms-font-m-plus ms-fontColor-neutralTertiary" id="demo"></p>
Inside the htaccess file of supercolored.com I added the following code:
<IfModule mod_headers.c>
<FilesMatch "\.(json|txt)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
When I try to debug it I receive the following error: SCRIPT5: Unhandled exception at line 129, column 5 in https://localhost:44382/Home.js 0x80070005
What I'm doing wrong?
Thank you
User contributions licensed under CC BY-SA 3.0