📌  相关文章
📜  xmlhttprequest javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:18.761000             🧑  作者: Mango

代码示例5
let xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function(){
    if(this.readyState === 4 && this.status === 200)
      {
        document.getElementById('response-div').innerHTML = this.responseText
      }
    }
    //get request with params
    xhr.open('GET', 'example?param1=true¶m2=2');
  xhr.send();
});