【发布时间】:2017-09-15 13:50:31
【问题描述】:
在 Firefox 中使用 F12,显示“NS_ERROR_FAILURE:” for html:16 (xml.send();)
根据开源网站https://data.gov.hk/en-data/dataset/clp-team1-electric-vehicle-charging-location/resource/c9dc4e0f-c618-445b-9c00-7f3d952b1e8a,表示可以使用HTTPS请求方法:GET。为什么显示错误?谢谢!
<html>
<head>
<title>Reading XML file</title>
</head>
<body>
<h1>XML file</h1>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert("I am an alert box!");
var xml = new XMLHttpRequest();
xml.open('GET','https://opendata.clp.com.hk/GetChargingSectionXML.aspx?lang=en',false);
xml.send();
var xmlData = xml.responseText;
document.write(xmlData);
}
【问题讨论】:
标签: javascript html asp.net xml