Visual Studio Excel Addin Unhandled exception trying to access to remote json

0

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

visual-studio
excel-addins
asked on Stack Overflow Nov 3, 2018 by Luca • edited Nov 3, 2018 by sideshowbarker

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0