利用XMLHttpRequest对象
1 2 3 4 5 6 7 8 9 10 11 |
let xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) { var response = xhr.responseText; console.log(response) } else { console.log("HTTP请求失败") } }; xhr.send(); |
你游戏用什么语言写的
ts
勘误: if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)
编辑器问题,乱码了那里