creator1.9.2
var xhr = new XMLHttpRequest();
var url = "http://hq.sinajs.cn/list=C0";
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
var response = xhr.responseText;
console.log(response);
console.log(JSON.stringify(response));
}
};
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type","text/plain");
xhr.send();
得到的response是空字符串,但其实应该是如下数据:

