Ajax xml 调用 Dynatrace 仪表板的权限被拒绝

Permission Denied on Ajax xml call, Dynatrace Dashboard

我一直在尝试使用 REST api 从 Dynatrace 服务器获取 XML 响应。当我通过 Postman 发送 url 时,我可以轻松获得 XML 响应,并且我能够从 ajax 接收到 'text' 数据类型响应,但不能接收到 'xml' 响应。我打算将这些数据解析成 json 以供将来使用。

目前我使用的代码是:

function getXML() {
      basicAuth = "Basic " + id + ":" + password;

      $.ajaxSetup({
            async: false
      });

      $.ajax({
            type: 'GET',
            url: dynUrl, //this is the function we defined above
            dataType: 'xml',
            headers: {
                'Authorization': basicAuth //this is for basic authentication, you've already provided UID and PWD above.
            },

            //when we succeed, the function below will be called.
            success: function(respt)
            {
                  data = respt;
            }
      });
}

这在下面的函数中被调用。

function XMLRespond()
{
      getXML();
      //dom = parseXml(data);
      //json = xmlToJson(dom);
      return data;
}

data 由本地主机上托管的 html 调用和显示。但是,当我 运行 这个时,我得到一个空白屏幕并且控制台显示 "Permission Denied"。我的调试器给我:

Failed to open http://localhost:8080/api/Test.html

非常感谢对此问题的任何帮助!

问题已解决。结果是 IE(我怀疑其他浏览器)无法直接显示 data。将 data 转换为字符串绕过了这个问题。